[petsc-users] Using MatCreateSubMatrix

Rakesh Halder rhalder at umich.edu
Thu Jun 18 15:14:04 CDT 2020


Hi all,

I'm writing an algorithm using PETSc that requires part of an (N x k)
matrix, where k << N. Specifically, my algorithm loops from j = 1 to k, and
uses j columns of the matrix of a time. I've been creating a new matrix for
each iteration, and use MatGetColumnVector to get the values for each
column vector, scatter them into a new vector, and then use MatSetValue to
populate my matrix. MatGetColumnVector is very slow, and I was thinking of
using MatCreateSubMatrix. However, I'm not entirely sure how to get the
correct IS that would allow me to create a submatrix using the first j
columns of the matrix at a time. I'm running in parallel, and the matrix is
an MPIAIJ matrix. I've looked at examples of MatCreateSubMatrix as well as
examples including the use of IS, but I'm still not very sure how to use
them.

Thanks,

Rakesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200618/014a1926/attachment-0001.html>


More information about the petsc-users mailing list