[petsc-users] Does PETSc have some functions like A.*B, A./B in Matlab?

Yujie recrusader at gmail.com
Sun Feb 21 14:33:23 CST 2010


Thanks very much, Jed.
I have a vector (V) and a matrix (A),
I want to do Row_i_A.*V or Row_i_A./V (Row_i_A are the rows of A). However,
V has different format with the rows of A.

If I use MatGetValues(), I don't care whether there are zero entries in A
when I extract a row of A. MatGetValues() will fill the entries with zero if
the entries are zero in sparse matrix.
The problem is I need to be careful when doing Row_i_A./V.

Regards,
Yujie

On Sun, Feb 21, 2010 at 2:29 PM, Jed Brown <jed at 59a2.org> wrote:

> On Sun, 21 Feb 2010 14:19:48 -0600, Yujie <recrusader at gmail.com> wrote:
> > It is not only for A./B. If one wants to do A.*B, it is not necessary to
> > guarantee the nonzeros of B. Generally, I think MatGetValues() will be
> good
> > choice although you need to judge whether the entries are zero when doing
> > A./B.
>
> MatGetValues requires you to know the nonzero pattern of B (or in the
> case of .*, the union of the nonzeros of A and B).  What problem are you
> trying to solve where you need to do this operation?  Perhaps we can
> suggest a better way.
>
> Jed
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100221/c61ebff8/attachment.htm>


More information about the petsc-users mailing list