:orphan: # KSPGetIterationNumber Gets the current iteration number; if the `KSPSolve()` is complete, returns the number of iterations used. ## Synopsis ``` #include "petscksp.h" PetscErrorCode KSPGetIterationNumber(KSP ksp, PetscInt *its) ``` Not Collective ## Input Parameter - ***ksp -*** the iterative context ## Output Parameter - ***its -*** number of iterations ## Note During the ith iteration this returns i-1 ## See Also [](ch_ksp), `KSP`, `KSPGetResidualNorm()`, `KSPBuildResidual()`, `KSPGetResidualNorm()`, `KSPGetTotalIterations()` ## Level intermediate ## Location src/ksp/ksp/interface/iterativ.c ## Examples src/ksp/ksp/tutorials/bench_kspsolve.c
src/ksp/ksp/tutorials/ex1.c
src/ksp/ksp/tutorials/ex11.c
src/ksp/ksp/tutorials/ex11f.F90
src/ksp/ksp/tutorials/ex12.c
src/ksp/ksp/tutorials/ex14f.F90
src/ksp/ksp/tutorials/ex15.c
src/ksp/ksp/tutorials/ex15f.F90
src/ksp/ksp/tutorials/ex16.c
src/ksp/ksp/tutorials/ex18.c
src/ksp/ksp/tutorials/ex19.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/iterativ.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)