MatHYPRESetPreallocation — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# 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

Matrices, `Mat`, `MatCreate()`, `MatMPIAIJSetPreallocation()`, `MATHYPRE`, `MATAIJ`

## Level

intermediate

## Location

src/mat/impls/hypre/mhypre.c

## Examples

src/ksp/ksp/tutorials/ex4.c
src/ksp/ksp/tutorials/ex55.c

## Implementations

MatHYPRESetPreallocation_HYPRE() in src/mat/impls/hypre/mhypre.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages