:orphan:
# MatCreateMPISBAIJWithArrays
creates a `MATMPISBAIJ` matrix using arrays that contain in standard CSR format the local rows. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateMPISBAIJWithArrays(MPI_Comm comm, PetscInt bs, PetscInt m, PetscInt n, PetscInt M, PetscInt N, const PetscInt i[], const PetscInt j[], const PetscScalar a[], Mat *mat)
```
Collective


## Input Parameters

- ***comm -*** MPI communicator
- ***bs -*** the block size, only a block size of 1 is supported
- ***m -*** number of local rows (Cannot be `PETSC_DECIDE`)
- ***n -*** This value should be the same as the local size used in creating the
x vector for the matrix-vector product y = Ax. (or `PETSC_DECIDE` to have
calculated if `N` is given) For square matrices `n` is almost always `m`.
- ***M -*** number of global rows (or `PETSC_DETERMINE` to have calculated if `m` is given)
- ***N -*** number of global columns (or `PETSC_DETERMINE` to have calculated if `n` is given)
- ***i -*** row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix
- ***j -*** column indices
- ***a -*** matrix values



## Output Parameter

- ***mat -*** the matrix





## Notes
The `i`, `j`, and `a` arrays ARE copied by this routine into the internal format used by PETSc;
thus you CANNOT change the matrix entries by changing the values of `a` after you have
called this routine. Use `MatCreateMPIAIJWithSplitArrays()` to avoid needing to copy the arrays.

The `i` and `j` indices are 0 based, and `i` indices are indices corresponding to the local `j` array.


## See Also
 [](ch_matrices), `Mat`, `MATMPISBAIJ`, `MatCreate()`, `MatCreateSeqAIJ()`, `MatSetValues()`, `MatMPIAIJSetPreallocation()`, `MatMPIAIJSetPreallocationCSR()`,
`MPIAIJ`, `MatCreateAIJ()`, `MatCreateMPIAIJWithSplitArrays()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/sbaij/mpi/mpisbaij.c.html#MatCreateMPISBAIJWithArrays">src/mat/impls/sbaij/mpi/mpisbaij.c</A>


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