Actual source code: gltrimpl.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, we continue to build the      */
  6: /* tridiagonal Lanczos matrix for a fixed number of iterations.  After this  */
  7: /* matrix is computed, we compute a global solution to solve the trust-      */
  8: /* region problem with the tridiagonal approximation by using a variant of   */
  9: /* the More'-Sorenson algorithm.  The direction is then constructed from     */
 10: /* this solution.                                                            */
 11: /*                                                                           */
 12: /* This method is described in:                                              */
 13: /*   N. Gould, S. Lucidi, M. Roma, and Ph. Toint, "Solving the Trust-Region  */
 14: /*     Subproblem using the Lanczos Method", SIAM Journal on Optimization,   */
 15: /*     9, pages 504-525, 1999.                                               */
 16: /*****************************************************************************/

 18: #ifndef PETSC_CG_GLTRIMPL_H
 19: #define PETSC_CG_GLTRIMPL_H

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

 23: typedef struct {
 24:   PetscReal *diag;   /* Diagonal part of Lanczos matrix           */
 25:   PetscReal *offd;   /* Off-diagonal part of Lanczos matrix       */
 26:   PetscReal *alpha;  /* Record of alpha values from CG            */
 27:   PetscReal *beta;   /* Record of beta values from CG             */
 28:   PetscReal *norm_r; /* Record of residual values from CG         */

 30:   PetscReal    *rwork; /* Real workspace for solver computations    */
 31:   PetscBLASInt *iwork; /* Integer workspace for solver computations */

 33:   PetscReal radius;
 34:   PetscReal norm_d;
 35:   PetscReal e_min;
 36:   PetscReal o_fcn;
 37:   PetscReal lambda;

 39:   PetscReal init_pert;  /* Initial perturbation for solve            */
 40:   PetscReal eigen_tol;  /* Tolerance used when computing eigenvalue  */
 41:   PetscReal newton_tol; /* Tolerance used for newton method          */

 43:   PetscInt alloced;    /* Size of workspace vectors allocated       */
 44:   PetscInt init_alloc; /* Initial size for workspace vectors        */

 46:   PetscInt max_lanczos_its; /* Maximum lanczos iterations                */
 47:   PetscInt max_newton_its;  /* Maximum newton iterations                 */
 48:   PetscInt dtype;           /* Method used to measure the norm of step   */
 49: } KSPCG_GLTR;

 51: #endif // PETSC_CG_GLTRIMPL_H