Skip to main content
`Ctrl`+`K`

# MatAIJGetLocalMat

Creates a `MATSEQAIJ` from a `MATAIJ` matrix.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatAIJGetLocalMat(Mat A, Mat *A_loc)

Not Collective

## Input Parameter

- A - the matrix

## Output Parameter

- A_loc - the local sequential matrix generated

## Notes

The matrix is created by taking `A`’s local rows and putting them into a sequential matrix with `mlocal` rows and `n` columns. Where `mlocal` is obtained with `MatGetLocalSize()` and `n` is the global column count obtained with `MatGetSize()`

In other words combines the two parts of a parallel `MATMPIAIJ` matrix on each process to a single matrix.

For parallel matrices this creates an entirely new matrix. If the matrix is sequential it merely increases the reference count.

Destroy the matrix with `MatDestroy()`

## See Also

Matrices, `Mat`, `MatMPIAIJGetLocalMat()`

## Level

developer

## Location

src/mat/impls/aij/mpi/mpiaij.c

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