Skip to main content
`Ctrl`+`K`

# MatSetErrorIfFailure

Causes `Mat` to generate an immediate error, for example a zero pivot, is detected.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatSetErrorIfFailure(Mat mat, PetscBool flg)

Logically Collective

## Input Parameters

- mat - matrix obtained from `MatCreate()`

- flg - `PETSC_TRUE` indicates you want the error generated

## Note

If this flag is not set then the matrix operation will note the error and continue. The error may cause a later `PC` or `KSP` error or result in a `KSPConvergedReason` indicating the method did not converge.

## See Also

Matrices, `Mat`, `PCSetErrorIfFailure()`, `KSPConvergedReason`, `SNESConvergedReason`

## Level

advanced

## Location

src/mat/utils/gcreate.c

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