# KSPLSQRGetNorms
Get the norm estimates that `KSPLSQR` computes internally during `KSPSolve()`. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPLSQRGetNorms(KSP ksp, PetscReal *arnorm, PetscReal *anorm)
```
Not Collective


## Input Parameter

- ***ksp   -*** iterative context



## Output Parameters

- ***arnorm -*** good estimate of norm((A*inv(Pmat))'*r), where r = A*x - b, used in specific stopping criterion
- ***anorm -*** poor estimate of norm(A*inv(Pmat),'fro') used in specific stopping criterion



## Notes
Output parameters are meaningful only after `KSPSolve()`.

These are the same quantities as normar and norma in MATLAB's `lsqr()`, whose output lsvec is a vector of normar / norma for all iterations.

If -ksp_lsqr_exact_mat_norm is set or `KSPLSQRSetExactMatNorm`(ksp, `PETSC_TRUE`) called, then anorm is the exact Frobenius norm.




## See Also
 [](chapter_ksp), `KSPSolve()`, `KSPLSQR`, `KSPLSQRSetExactMatNorm()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/lsqr/lsqr.c.html#KSPLSQRGetNorms">src/ksp/ksp/impls/lsqr/lsqr.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/impls/lsqr/lsqr.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)  
