:orphan:
# KSPSTCG
Code to run conjugate gradient method subject to a constraint on the solution norm. 
## Options Database Keys

- ***-ksp_cg_radius <r> -*** Trust Region Radius



## Notes
This is rarely used directly, it is used in Trust Region methods for nonlinear equations, `SNESNEWTONTR`

Use preconditioned conjugate gradient to compute
an approximate minimizer of the quadratic function

q(s) = g^T * s + 0.5 * s^T * H * s

subject to the trust region constraint

|| s || <= delta,

where

delta is the trust region radius,
g is the gradient vector,
H is the Hessian approximation, and
M is the positive definite preconditioner matrix.

`KSPConvergedReason` may be
```none
   KSP_CONVERGED_NEG_CURVE if convergence is reached along a negative curvature direction,
   KSP_CONVERGED_STEP_LENGTH if convergence is reached along a constrained step,
```

other `KSP` converged/diverged reasons

The preconditioner supplied should be symmetric and positive definite.


## References

- **** -*** Steihaug, T. (1983): The conjugate gradient method and trust regions in large scale optimization. SIAM J. Numer. Anal. 20, 626--637
- **** -*** Toint, Ph.L. (1981): Towards an efficient sparsity exploiting Newton method for minimization. In: Duff, I., ed., Sparse Matrices and Their Uses, pp. 57--88. Academic Press





## See Also
 [](ch_ksp), `KSPCreate()`, `KSPCGSetType()`, `KSPType`, `KSP`, `KSPCGSetRadius()`, `KSPCGGetNormD()`, `KSPCGGetObjFcn()`, `KSPNASH`, `KSPGLTR`, `KSPQCG`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/cg/stcg/stcg.c.html#KSPSTCG">src/ksp/ksp/impls/cg/stcg/stcg.c</A>


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