:orphan:
# KSPSetComputeEigenvalues
Sets a flag so that the extreme eigenvalues values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
## Synopsis
```
#include "petscksp.h"
#include "petscmat.h"
PetscErrorCode KSPSetComputeEigenvalues(KSP ksp, PetscBool flg)
```
Logically Collective
## Input Parameters
- ***ksp -*** iterative context obtained from `KSPCreate()`
- ***flg -*** `PETSC_TRUE` or `PETSC_FALSE`
## Note
Currently this option is not valid for all iterative methods.
## See Also
[](ch_ksp), `KSPComputeEigenvalues()`, `KSPComputeEigenvaluesExplicitly()`, `KSP`
## Level
advanced
## Location
src/ksp/ksp/interface/itfunc.c
## Examples
src/ksp/ksp/tutorials/ex71.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)