:orphan:
# MatHYPRESetPreallocation
Preallocates memory for a sparse parallel matrix in HYPRE IJ format 
## Synopsis
```
PetscErrorCode MatHYPRESetPreallocation(Mat A, PetscInt dnz, const PetscInt dnnz[], PetscInt onz, const PetscInt onnz[])
```
Collective


## Input Parameters

- ***A -*** the matrix
- ***dnz  -*** number of nonzeros per row in DIAGONAL portion of local submatrix
(same value is used for all local rows)
- ***dnnz -*** 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` (`PETSC_NULL_INTEGER` in Fortran), 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.
- ***onz  -*** number of nonzeros per row in the OFF-DIAGONAL portion of local
submatrix (same value is used for all local rows).
- ***onnz -*** 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` (`PETSC_NULL_INTEGER` in Fortran), 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`.





## Note
If the *nnz parameter is given then the *nz parameter is ignored; for sequential matrices, `onz` and `onnz` are ignored.


## See Also
 [](ch_matrices), `Mat`, `MatCreate()`, `MatMPIAIJSetPreallocation()`, `MATHYPRE`, `MATAIJ`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/hypre/mhypre.c.html#MatHYPRESetPreallocation">src/mat/impls/hypre/mhypre.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex4.c.html">src/ksp/ksp/tutorials/ex4.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex55.c.html">src/ksp/ksp/tutorials/ex55.c</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/hypre/mhypre.c.html#MatHYPRESetPreallocation_HYPRE">MatHYPRESetPreallocation_HYPRE in src/mat/impls/hypre/mhypre.c</A><BR>


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