# MatNestGetSubMats
Returns the entire two dimensional array of matrices defining a `MATNEST` matrix. 
## Synopsis
```
#include "petscmat.h"   
PetscErrorCode MatNestGetSubMats(Mat A, PetscInt *M, PetscInt *N, Mat ***mat)
```
Not collective


## Input Parameter

- ***A  -*** nest matrix



## Output Parameters

- ***M -*** number of rows in the nest matrix
- ***N -*** number of cols in the nest matrix
- ***mat -*** 2d array of matrices



## Note
The user should not free the array mat.


## Fortran Note
This routine has a calling sequence
```none
call MatNestGetSubMats(A, M, N, mat, ierr)
```
where the space allocated for the optional argument mat is assumed large enough (if provided).




## See Also
 `MATNEST`, `MatNestGetSize()`, `MatNestGetSubMat()`, `MatNestGetLocalISs()`, `MATNEST`, `MatCreateNest()`,
`MatNestSetSubMats()`, `MatNestGetISs()`, `MatNestSetSubMat()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/nest/matnest.c.html#MatNestGetSubMats">src/mat/impls/nest/matnest.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/nest/matnest.c.html#MatNestGetSubMats_Nest">MatNestGetSubMats_Nest in src/mat/impls/nest/matnest.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/nest/matnest.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)  
