# MatCreateSubMatricesMPI
Extracts MPI submatrices across a sub communicator of mat (by pairs of `IS` that may live on subcomms).
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatCreateSubMatricesMPI(Mat mat, PetscInt n, const IS irow[], const IS icol[], MatReuse scall, Mat *submat[])
```
Collective
## Input Parameters
- ***mat -*** the matrix
- ***n -*** the number of submatrixes to be extracted
- ***irow, icol -*** index sets of rows and columns to extract
- ***scall -*** either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX`
## Output Parameter
- ***submat -*** the array of submatrices
## Note
This is used by `PCGASM`
## See Also
`Mat`, `PCGASM`, `MatCreateSubMatrices()`, `MatCreateSubMatrix()`, `MatGetRow()`, `MatGetDiagonal()`, `MatReuse`
## Level
advanced
## Location
src/mat/interface/matrix.c
## Implementations
MatCreateSubMatricesMPI_MPIAdj in src/mat/impls/adj/mpi/mpiadj.c
MatCreateSubMatricesMPI_MPIXAIJ(Mat C, PetscInt ismax, const IS isrow[], const IS iscol[], MatReuse scall, Mat *submat[], PetscErrorCode (*getsubmats_seq)(Mat, PetscInt, const IS[], const IS[], MatReuse, Mat **), PetscErrorCode (*getlocalmats)(Mat, Mat *, Mat *), PetscErrorCode (*setseqmat)(Mat, IS, IS, MatStructure, Mat), PetscErrorCode (*setseqmats) in src/mat/impls/aij/mpi/mpiov.c
MatCreateSubMatricesMPI_MPIAIJ in src/mat/impls/aij/mpi/mpiov.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.c)
[Index of all Mat routines](index.md)
[Table of Contents for all manual pages](/docs/manualpages/index.md)
[Index of all manual pages](/docs/manualpages/singleindex.md)