Skip to main content
`Ctrl`+`K`

# 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

Matrices, `Mat`, `MATSUBMATRIX`, `MatCreateSubMatrixVirtual()`, `MatSetValuesLocal()`, `MatSetValuesBlockedLocal()`, `MatGetLocalSubMatrix()`, `MatCreateSubMatrix()`

## Level

developer

## Location

src/mat/impls/localref/mlocalref.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages