Skip to main content
`Ctrl`+`K`

# MatResetPreallocation

Reset matrix to use the original preallocation values provided by the user, for example with `MatXAIJSetPreallocation()`

## Synopsis

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

Collective

## Input Parameter

- A - the matrix

## Notes

After calling `MatAssemblyBegin()` and `MatAssemblyEnd()` with `MAT_FINAL_ASSEMBLY` the matrix data structures represent the nonzeros assigned to the matrix. If that space is less than the preallocated space that extra preallocated space is no longer available to take on new values. `MatResetPreallocation()` makes all of the preallocation space available

Current values in the matrix are lost in this call

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/ex4f.F90
src/mat/tutorials/ex4.c

## 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