[petsc-users] MatSetValues vs. MatSetValue

Jed Brown jedbrown at mcs.anl.gov
Mon Nov 4 09:08:43 CST 2013


Qin Lu <lu_qin_2000 at yahoo.com> writes:

> Hello,
>  
> I need to set values of a sparse matrix. Is setting coefficients row
> by row using MatSetValues more efficient than setting setting
> coefficient one by one using MatSetValue? 

Somewhat more efficient, yes.

> Is MatSetValues implemented by looping over each entry of the input
> array calling MatSetValue? 

Calling for a group of entries (once per row or once per "element" in
finite element methods) amortizes some of the search cost.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131104/dc2001cb/attachment.pgp>


More information about the petsc-users mailing list