:orphan:
# KSPConvergedReasonViewSet
Sets an ADDITIONAL function that is to be used at the end of the linear solver to display the convergence reason of the linear solver.
## Synopsis
```
#include "petscksp.h"
#include "petscmat.h"
PetscErrorCode KSPConvergedReasonViewSet(KSP ksp, PetscErrorCode (*f)(KSP, void *), void *vctx, PetscErrorCode (*reasonviewdestroy)(void **))
```
Logically Collective
## Input Parameters
- ***ksp -*** the `KSP` context
- ***f -*** the ksp converged reason view function
- ***vctx -*** [optional] user-defined context for private data for the
ksp converged reason view routine (use `NULL` if no context is desired)
- ***reasonviewdestroy -*** [optional] routine that frees reasonview context
(may be `NULL`)
## Options Database Keys
- ***-ksp_converged_reason -*** sets a default `KSPConvergedReasonView()`
- ***-ksp_converged_reason_view_cancel -*** cancels all converged reason viewers that have
been hardwired into a code by
calls to `KSPConvergedReasonViewSet()`, but
does not cancel those set via
the options database.
## Notes
Several different converged reason view routines may be set by calling
`KSPConvergedReasonViewSet()` multiple times; all will be called in the
order in which they were set.
## See Also
[](ch_ksp), `KSPConvergedReasonView()`, `KSPConvergedReasonViewCancel()`
## Level
intermediate
## Location
src/ksp/ksp/interface/itfunc.c
## Examples
src/snes/tutorials/ex6.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/itfunc.c)
[Index of all KSP routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)