Actual source code: nashimpl.h

  1: /*****************************************************************************/
  2: /* Context for using preconditioned conjugate gradient method to minimized a */
  3: /* quadratic function subject to a trust region constraint.  If the matrix   */
  4: /* is indefinite, a direction of negative curvature may be encountered.  If  */
  5: /* a direction of negative curvature is found during the first iteration,    */
  6: /* then it is a preconditioned gradient direction and we follow it to the    */
  7: /* boundary of the trust region.  If a direction of negative curvature is    */
  8: /* encountered on subsequent iterations, then we terminate the algorithm.    */
  9: /*                                                                           */
 10: /* This method is described in:                                              */
 11: /*   S. Nash, "Newton-type Minimization via the Lanczos Method", SIAM        */
 12: /*     Journal on Numerical Analysis, 21, pages 553-572, 1984.               */
 13: /*****************************************************************************/

 15: #pragma once

 17: #include <petsc/private/kspimpl.h>

 19: typedef struct {
 20:   PetscReal radius;
 21:   PetscReal norm_d;
 22:   PetscReal o_fcn;
 23:   PetscInt  dtype;
 24: } KSPCG_NASH;