Skip to main content
`Ctrl`+`K`

# MFNGetConvergedReason

Gets the reason why the `MFNSolve()` iteration was stopped.

## Synopsis

    #include "slepcmfn.h"
    PetscErrorCode MFNGetConvergedReason(MFN mfn,MFNConvergedReason *reason)

Not Collective

## Input Parameter

- mfn - the matrix function solver context

## Output Parameter

- reason - negative value indicates diverged, positive value converged, see `MFNConvergedReason` for the possible values

## Options Database Key

- -mfn_converged_reason - print reason for convergence/divergence, and number of iterations

## Notes

If this routine is called before or doing the `MFNSolve()` the value of `MFN_CONVERGED_ITERATING` is returned.

Basic solvers (e.g., unrestarted Krylov iterations) cannot determine if the computation is accurate up to the requested tolerance. In that case, the converged reason is set to `MFN_CONVERGED_ITS` if the requested number of steps (for instance, the `ncv` value in unrestarted Krylov methods) have been completed successfully.

## See Also

MFN: Matrix Function, `MFNSetTolerances()`, `MFNSolve()`, `MFNConvergedReason`, `MFNSetErrorIfNotConverged()`

## Level

intermediate

## Location

src/mfn/interface/mfnsolve.c

## Examples

src/mfn/tutorials/ex23f.F90
src/mfn/tutorials/ex37.c
src/mfn/tutorials/ex23.c

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