[petsc-users] Doubt in MPIPreallocation

Jed Brown jed at jedbrown.org
Fri Feb 19 08:46:06 CST 2016


John Albequerque <johncfdcfd at gmail.com> writes:

> So Jed, what you are suggesting is that I should set only the non-zero
> elements while using
> *  MatSetValues(A,(high-low),**idxm,nc,idxn,values,INSERT_*
>
> *VALUES);*
> And not mention the zero elements and for that I should loop over all local
> rows and then set each of the value.

Yes.  The whole point of a sparse matrix is to spend no time or storage
on 0.0 entries.  If you allocate a dense matrix and store all the zeros,
you're just being inefficient relative to a dense format.
-------------- 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/20160219/62bbbd7b/attachment-0001.pgp>


More information about the petsc-users mailing list