petsc-3.15.0 2021-03-30
Report Typos and Errors

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

### Input Parameters

| mat | - the matrix

### Notes

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.

### See Also

MatZeroRows()

### Level

intermediate

### Location

src/mat/interface/matrix.c

### Examples

src/ksp/ksp/tutorials/ex5.c.html
src/ksp/ksp/tutorials/ex9.c.html
src/ksp/ksp/tutorials/ex42.c.html
src/ksp/ksp/tutorials/ex43.c.html
src/ksp/ksp/tutorials/ex49.c.html
src/ksp/ksp/tutorials/ex59.c.html
src/ksp/ksp/tutorials/ex67.c.html
src/ksp/ksp/tutorials/ex70.c.html
src/ksp/ksp/tutorials/ex73.c.html
src/ksp/ksp/tutorials/ex77.c.html
src/ksp/ksp/tutorials/ex81.c.html
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages