# KSPQCGGetQuadratic
Gets the value of the quadratic function, evaluated at the new iterate: 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode KSPQCGGetQuadratic(KSP ksp, PetscReal *quadratic)
```
q(s) = g^T * s + 0.5 * s^T * H * s

which satisfies the Euclidian Norm trust region constraint

|| D * s || <= delta,

where

delta is the trust region radius,
g is the gradient vector, and
H is Hessian matrix,
D is a scaling matrix.

Collective on ksp


## Input Parameter

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



## Output Parameter

- ***quadratic -*** the quadratic function evaluated at the new iterate





## See Also
 [](chapter_ksp), `KSPQCG`

## Level
advanced

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/qcg/qcg.c.html#KSPQCGGetQuadratic_QCG">KSPQCGGetQuadratic_QCG in src/ksp/ksp/impls/qcg/qcg.c</A><BR>


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