:orphan:
# MatMPIAIJGetLocalMatMerge
Creates a `MATSEQAIJ` from a `MATMPIAIJ` matrix by taking all its local rows and putting them into a sequential matrix with mlocal rows and n columns. Where n is the sum of the number of columns of the diagonal and offdiagonal part
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatMPIAIJGetLocalMatMerge(Mat A, MatReuse scall, IS *glob, Mat *A_loc)
```
Not Collective
## Input Parameters
- ***A -*** the matrix
- ***scall -*** either `MAT_INITIAL_MATRIX` or `MAT_REUSE_MATRIX`
## Output Parameters
- ***glob -*** sequential `IS` with global indices associated with the columns of the local sequential matrix generated (can be `NULL`)
- ***A_loc -*** the local sequential matrix generated
## Note
This is different from `MatMPIAIJGetLocalMat()` since the first columns in the returning matrix are those associated with the diagonal
part, then those associated with the off diagonal part (in its local ordering)
## See Also
[](ch_matrices), `Mat`, `MATMPIAIJ`, `MatGetOwnershipRange()`, `MatMPIAIJGetLocalMat()`, `MatMPIAIJGetLocalMatCondensed()`
## Level
developer
## Location
src/mat/impls/aij/mpi/mpiaij.c
## Implementations
MatMPIAIJGetLocalMatMerge_MPIAIJKokkos in src/mat/impls/aij/mpi/kokkos/mpiaijkok.kokkos.cxx
MatMPIAIJGetLocalMatMerge_MPIAIJCUSPARSE in src/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.cu
MatMPIAIJGetLocalMatMerge_MPIAIJHIPSPARSE in src/mat/impls/aij/mpi/mpihipsparse/mpiaijhipsparse.hip.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/aij/mpi/mpiaij.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)