Code to run conjugate gradient method subject to a constraint on the solution norm. This is used in Trust Region methods for nonlinear equations, SNESNEWTONTR

Options Database Keys

-ksp_cg_radius <r> - Trust Region Radius


This is rarely used directly

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

q(s) = g^T * s + .5 * s^T * H * s

subject to the trust region constraint

|| s || <= delta,


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

KSPConvergedReason may be

 KSP_CONVERGED_CG_NEG_CURVE if convergence is reached along a negative curvature direction,
 KSP_CONVERGED_CG_CONSTRAINED if convergence is reached along a constrained step,
 other KSP converged/diverged reasons


The preconditioner supplied should be symmetric and positive definite.


Gould, N. and Lucidi, S. and Roma, M. and Toint, P., Solving the Trust-Region Subproblem using the Lanczos Method, SIAM Journal on Optimization, volume 9, number 2, 1999, 504-525

Level: developer

See Also

KSPCreate(), KSPSetType(), KSPType (for list of available types), KSP, KSPCGSetRadius(), KSPCGGetNormD(), KSPCGGetObjFcn(), KSPGLTRGetMinEig(), KSPGLTRGetLambda()