:orphan:
# MatISSetPreallocation
Preallocates memory for a `MATIS` parallel matrix.
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatISSetPreallocation(Mat B, PetscInt d_nz, const PetscInt d_nnz[], PetscInt o_nz, const PetscInt o_nnz[])
```
Collective
## Input Parameters
- ***B -*** the matrix
- ***d_nz -*** number of nonzeros per row in DIAGONAL portion of local submatrix
(same value is used for all local rows)
- ***d_nnz -*** array containing the number of nonzeros in the various rows of the
DIAGONAL portion of the local submatrix (possibly different for each row)
or `NULL`, if `d_nz` is used to specify the nonzero structure.
The size of this array is equal to the number of local rows, i.e `m`.
For matrices that will be factored, you must leave room for (and set)
the diagonal entry even if it is zero.
- ***o_nz -*** number of nonzeros per row in the OFF-DIAGONAL portion of local
submatrix (same value is used for all local rows).
- ***o_nnz -*** array containing the number of nonzeros in the various rows of the
OFF-DIAGONAL portion of the local submatrix (possibly different for
each row) or `NULL`, if `o_nz` is used to specify the nonzero
structure. The size of this array is equal to the number
of local rows, i.e `m`.
If the *_nnz parameter is given then the *_nz parameter is ignored
## Note
This function has the same interface as the `MATMPIAIJ` preallocation routine in order to simplify the transition
from the asssembled format to the unassembled one. It overestimates the preallocation of `MATIS` local
matrices; for exact preallocation, the user should set the preallocation directly on local matrix objects.
## See Also
[](ch_matrices), `Mat`, `MatCreate()`, `MatCreateIS()`, `MatMPIAIJSetPreallocation()`, `MatISGetLocalMat()`, `MATIS`
## Level
intermediate
## Location
src/mat/impls/is/matis.c
## Examples
src/mat/tutorials/ex3.c
## Implementations
MatISSetPreallocation_IS in src/mat/impls/is/matis.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/is/matis.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)