:orphan:
# KSP_GMRES_CGS_REFINE_IFNEEDED
Do the classical (unmodified) Gram-Schmidt process and one step of iterative refinement if an estimate of the orthogonality of the resulting vectors indicates poor orthogonality. 


## Note
This is slower than `KSP_GMRES_CGS_REFINE_NEVER` because it requires an extra norm computation to
estimate the orthogonality but is more stable.


## See Also
 [](ch_ksp), `KSPGMRESCGSRefinementType`, `KSPGMRESClassicalGramSchmidtOrthogonalization()`, `KSPGMRESSetOrthogonalization()`,
`KSP`, `KSPGMRESGetOrthogonalization()`,
`KSPGMRESSetCGSRefinementType()`, `KSPGMRESGetCGSRefinementType()`, `KSP_GMRES_CGS_REFINE_NEVER`, `KSP_GMRES_CGS_REFINE_ALWAYS`,
`KSPGMRESModifiedGramSchmidtOrthogonalization()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscksp.h.html#KSP_GMRES_CGS_REFINE_IFNEEDED">include/petscksp.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscksp.h)


[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)  
