Skip to main content
`Ctrl`+`K`

# MatResetPreallocation

Reset matrix to use the original nonzero pattern provided by the user.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatResetPreallocation(Mat A)

Collective

## Input Parameter

- A - the matrix

## Notes

The allocated memory will be shrunk after calling `MatAssemblyBegin()` and `MatAssemblyEnd()` with `MAT_FINAL_ASSEMBLY`.

Users can reset the preallocation to access the original memory.

Currently only supported for `MATAIJ` matrices.

## See Also

Matrices, `Mat`, `MatSeqAIJSetPreallocation()`, `MatMPIAIJSetPreallocation()`, `MatXAIJSetPreallocation()`

## Level

beginner

## Location

src/mat/interface/matrix.c

## Examples

src/mat/tutorials/ex4.c
src/mat/tutorials/ex4f.F90

## Implementations

MatResetPreallocation_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c
MatResetPreallocation_SeqAIJ() in src/mat/impls/aij/seq/aij.c

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