MatGetSubMatrix

Gets a single submatrix on the same number of processors as the original matrix.

Synopsis

#include "petscmat.h" 
int MatGetSubMatrix(Mat mat,IS isrow,IS iscol,int csize,MatReuse cll,Mat *newmat)
Collective on Mat

Input Parameters

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

Output Parameter

newmat -the new submatrix, of the same type as the old

Notes: the iscol argument MUST be the same on each processor. You might be able to create the iscol argument with ISAllGather().

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 will reuse the matrix generated the first time.

See Also

MatGetSubMatrices(), ISAllGather()

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

Examples

src/sles/examples/tutorials/ex10.c.html