[petsc-users] MatAXPY not working as expected

Jed Brown jed at jedbrown.org
Sun Dec 21 10:54:27 CST 2014


Christoph Pohl <Metal-Gear-Rex at web.de> writes:

> Dear fellow PETSc users,
>
> I've been trying to subtract one matrix from another, i.e. Y = Y - X, using 
> `call MatAXPY(Y, minus_one, X, SAME_NONZERO_PATTERN, ierr)`. 

You can only use SAME_NONZERO_PATTERN pattern if the matrices have the
same nonzero pattern.  These matrices don't even have the same number of
nonzeros and there are quite a few entries in different places (neither
is a subset of the other).  Use DIFFERENT_NONZERO_PATTERN in cases like
this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141221/c23d1b84/attachment-0001.pgp>


More information about the petsc-users mailing list