# MatCreateSeqSBAIJWithArrays
Creates an sequential `MATSEQSBAIJ` matrix using matrix elements (upper triangular entries in CSR format) provided by the user. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateSeqSBAIJWithArrays(MPI_Comm comm, PetscInt bs, PetscInt m, PetscInt n, PetscInt i[], PetscInt j[], PetscScalar a[], Mat *mat)
```
Collective


## Input Parameters

- ***comm -*** must be an MPI communicator of size 1
- ***bs -*** size of block
- ***m -*** number of rows
- ***n -*** number of columns
- ***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 not copied by this routine, the user must free these arrays
once the matrix is destroyed

You cannot set new nonzero locations into this matrix, that will generate an error.

The i and j indices are 0 based

When block size is greater than 1 the matrix values must be stored using the SBAIJ storage format (see the SBAIJ source code to determine this). For block size of 1
it is the regular CSR format excluding the lower triangular elements.


## See Also
 `MATSEQSBAIJ`, `MatCreate()`, `MatCreateSBAIJ()`, `MatCreateSeqSBAIJ()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/sbaij/seq/sbaij.c.html#MatCreateSeqSBAIJWithArrays">src/mat/impls/sbaij/seq/sbaij.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/sbaij/seq/sbaij.c)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
