#include "petscmat.h" PetscErrorCode MatGetSubMatrix(Mat mat,IS isrow,IS iscol,PetscInt csize,MatReuse cll,Mat *newmat)Collective on Mat
mat | - the original matrix | |
isrow | - rows this processor should obtain | |
iscol | - columns for all processors you wish to keep | |
csize | - number of columns "local" to this processor (does nothing for sequential matrices). This should match the result from VecGetLocalSize(x,...) if you plan to use the matrix in a A*x; alternatively, you can use PETSC_DECIDE | |
cll | - either MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX |
Notes: the iscol argument MUST be the same on each processor. You might be able to create the iscol argument with ISAllGather(). The rows is isrow will be sorted into the same order as the original matrix.
The first time this is called you should use a cll of MAT_INITIAL_MATRIX, the MatGetSubMatrix() routine will create the newmat for you. Any additional calls to this routine with a mat of the same nonzero structure and with a call of MAT_REUSE_MATRIX will reuse the matrix generated the first time. You should call MatDestroy() on newmat when you are finished using it.
Level:advanced
Location:src/mat/interface/matrix.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages