:orphan:
# MatCreateLocalRef
Gets a logical reference to a local submatrix, for use in assembly, that is to set values into the matrix 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateLocalRef(Mat A, IS isrow, IS iscol, Mat *newmat)
```
Not Collective


## Input Parameters

- ***A -*** full matrix, generally parallel
- ***isrow -*** Local index set for the rows
- ***iscol -*** Local index set for the columns



## Output Parameter

- ***newmat -*** new serial `Mat`





## Notes
Most will use `MatGetLocalSubMatrix()` which returns a real matrix corresponding to the local
block if it available, such as with matrix formats that store these blocks separately.

The new matrix forwards `MatSetValuesLocal()` and `MatSetValuesBlockedLocal()` to the global system.
In general, it does not define `MatMult()` or any other functions.  Local submatrices can be nested.


## See Also
 [](ch_matrices), `Mat`, MATSUBMATRIX`, `MatCreateSubMatrixVirtual()`, `MatSetValuesLocal()`, `MatSetValuesBlockedLocal()`, `MatGetLocalSubMatrix()`, `MatCreateSubMatrix()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/localref/mlocalref.c.html#MatCreateLocalRef">src/mat/impls/localref/mlocalref.c</A>


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