# MatXAIJSetPreallocation
set preallocation for serial and parallel `MATAIJ`, `MATBAIJ`, and `MATSBAIJ` matrices and their unassembled versions. 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatXAIJSetPreallocation(Mat A, PetscInt bs, const PetscInt dnnz[], const PetscInt onnz[], const PetscInt dnnzu[], const PetscInt onnzu[])
```
Collective


## Input Parameters

- ***A -*** matrix being preallocated
- ***bs -*** block size
- ***dnnz -*** number of nonzero column blocks per block row of diagonal part of parallel matrix
- ***onnz -*** number of nonzero column blocks per block row of off-diagonal part of parallel matrix
- ***dnnzu -*** number of nonzero column blocks per block row of upper-triangular part of diagonal part of parallel matrix
- ***onnzu -*** number of nonzero column blocks per block row of upper-triangular part of off-diagonal part of parallel matrix





## See Also
 `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatSeqBAIJSetPreallocation()`, `MatMPIBAIJSetPreallocation()`, `MatSeqSBAIJSetPreallocation()`, `MatMPISBAIJSetPreallocation()`,
`PetscSplitOwnership()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/utils/gcreate.c.html#MatXAIJSetPreallocation">src/mat/utils/gcreate.c</A>


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