Actual source code: taocg.h

  1: /*
  2:     Context for conjugate gradient method (unconstrained minimization)
  3:  */

  5: #ifndef __TAO_CG_H

  8: #include <petsc/private/taoimpl.h>

 10: typedef struct {
 11:   Vec G_old;
 12:   Vec X_old;
 13:   Vec W; /*  work vector */

 15:   PetscReal eta;       /*  Restart tolerance */
 16:   PetscReal delta_max; /*  Minimum value for scaling */
 17:   PetscReal delta_min; /*  Maximum value for scaling */

 19:   /*  The algorithm restarts when the gradient at the current point g_k,
 20:        and the gradient of the previous point, g_{k-1}, satisfy the
 21:        following inequality:

 23:             abs(inner(g_k, g_{k-1})) > eta * norm(g_k, 2)^2. */

 25:   PetscInt ngradsteps;  /*  Number of gradient steps */
 26:   PetscInt nresetsteps; /*  Number of reset steps */

 28:   PetscInt cg_type; /*  Formula to use */
 29: } TAO_CG;

 31: #endif /* ifndef __TAO_CG_H */