[petsc-users] MatAYPX for dense and sparse matrices

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Mon Mar 21 06:23:11 CDT 2011


Alex,

If you are adding a sparse matrix to a dense one, you are better off just
iterating through the values of your sparse matrix and adding them to your
dense matrix.

As far as I know, there are no routines in PETSc that will do this
automatically for you (and this sort of thing is really not PETSc's
strength).

A

On Mon, Mar 21, 2011 at 2:14 PM, Alexander Grayver
<agrayver at gfz-potsdam.de>wrote:

> Hello!
>
> I have two matrices L and J. L is the sparse with 2 nonzeros per row
> maximum (quite often there are no values in a row at all) and J is the dense
> matrix. I need to add matrix L to matrix J so that:
>
> J = J + L
>
> I try to use:
> call MatAYPX(J,one,L,SUBSET_NONZERO_PATTERN,ierr)
>
> Because it seems most obvious and efficient way.
>
> and program crashes with this callstack:
>    unknown :: BLASaxpy_
>    dense.c :: MatAXPY_SeqDense
>     axpy.c :: MatAXPY
>     axpy.c :: MatAYPX
>     axpyf.c :: MATAYPX
>     MODELING_MOD::MODELING
>
> I figured out the only one working combination:
> call MatAXPY(LT,one,JT,DIFFERENT_NONZERO_PATTERN,ierr)
>
> But this is very slow and inefficient.
>
> What actually could be done in such a situation?
>
> Thanks in advance.
>
> Regards,
> Alexander
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110321/6ee8c477/attachment.htm>


More information about the petsc-users mailing list