:orphan:
# MatNestSetSubMat
Set a single submatrix in the `MATNEST` 
## Synopsis
```
#include "petscmat.h"   
PetscErrorCode MatNestSetSubMat(Mat A, PetscInt idxm, PetscInt jdxm, Mat sub)
```
Logically Collective


## Input Parameters

- ***A  -*** `MATNEST` matrix
- ***idxm -*** index of the matrix within the nest matrix
- ***jdxm -*** index of the matrix within the nest matrix
- ***sub -*** matrix at index `idxm`, `jdxm` within the nest matrix





## Notes
The new submatrix must have the same size and communicator as that block of the nest.

This increments the reference count of the submatrix.


## See Also
 [](ch_matrices), `Mat`, `MATNEST`, `MatNestSetSubMats()`, `MatNestGetSubMats()`, `MatNestGetLocalISs()`, `MATNEST`, `MatCreateNest()`,
`MatNestGetSubMat()`, `MatNestGetISs()`, `MatNestGetSize()`

## Level
developer

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/nest/matnest.c.html#MatNestSetSubMat_Nest">MatNestSetSubMat_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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
