# MatZeroEntries#

Zeros all entries of a matrix. For sparse matrices this routine retains the old nonzero structure.

## Synopsis#

#include "petscmat.h"
PetscErrorCode MatZeroEntries(Mat mat)


Logically Collective

## Input Parameters#

• mat - the matrix

## Note#

If the matrix was not preallocated then a default, likely poor preallocation will be set in the matrix, so this should be called after the preallocation phase. See the Performance chapter of the users manual for information on preallocating matrices.

Mat, MatZeroRows(), MatZeroRowsColumns()

intermediate

## Location#

src/mat/interface/matrix.c

Edit on GitLab