[petsc-users] inserting into sparse matricies

John-Michael Fischer fischej at umich.edu
Fri Mar 26 10:18:08 CDT 2010


I have a vector of values I want to insert into a sparse matrix as a row.  My vector contains non-zero values at their proper positions in the row and zero's elsewhere.  If I MatSetValues into a Mat setup in a sparse form, will PETSC automatically see the zero's and not insert them while working out the proper indecies of the non-zero elements?

Is there another calling sequence that lets me do this without calling MatSetValue for each non-zero entry since the non-zero entries are not contiguous in the row?

Alternatively, I was thinking I could assemble a vector with the indecies of the non-zero elements, then use that in the call to MatSetValues with a row vector of non-zero values only - but I wanted to ask first since this seems like a common usage pattern for PETSC sparse mat's.

Thanks,
John-Michael


More information about the petsc-users mailing list