# MatGetSubMatrixRaw

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

### Synopsis

    #include "petscmat.h"
    PetscErrorCode  MatGetSubMatrixRaw(Mat mat,PetscInt nrows,const PetscInt rows[],PetscInt ncols,const PetscInt cols[],PetscInt csize,MatReuse cll,Mat *newmat)

Collective on Mat

### Input Parameters

| mat | - the original matrix
| nrows | - the number of rows this processor should obtain
| rows | - rows this processor should obtain
| ncols | - the number of columns for all processors you wish to keep
| cols | - 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 and with a cll of MAT_REUSE_MATRIX 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