Skip to main content
`Ctrl`+`K`

# MatFilter

Set all values in the matrix with an absolute value less than or equal to the tolerance to zero, and optionally compress the underlying storage

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatFilter(Mat A, PetscReal tol, PetscBool compress, PetscBool keep)

## Input Parameters

- A - The matrix

- tol - The zero tolerance

- compress - Whether the storage from the input matrix `A` should be compressed once values less than or equal to `tol` are set to zero

- keep - If `compress` is true and for a given row of `A`, the diagonal coefficient is less than or equal to `tol`, indicates whether it should be left in the structure or eliminated as well

## See Also

Matrices, `Mat`, `MatCreate()`, `MatZeroEntries()`, `MatEliminateZeros()`, `VecFilter()`

## Level

intermediate

## Location

src/mat/utils/axpy.c

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