# KSPGetResidualNorm
Gets the last (possibly approximate and/or preconditioned) residual norm that has been computed. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPGetResidualNorm(KSP ksp, PetscReal *rnorm)
```
Not Collective


## Input Parameters

- ***ksp -*** the iterative context



## Output Parameters

- ***rnorm -*** residual norm





## Note
For some methods, such as `KSPGMRES`, the norm is not computed directly from the residual.

The type of norm used by the method can be controlled with `KSPSetNormType()`


## See Also
 [](chapter_ksp), `KSP`, `KSPSetNormType()`, `KSPBuildResidual()`, `KSPNormType`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/interface/iterativ.c.html#KSPGetResidualNorm">src/ksp/ksp/interface/iterativ.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex10.c.html">src/ksp/ksp/tutorials/ex10.c.html</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
