Actual source code: taocg.h

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


  6: #ifndef __TAO_CG_H

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

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

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


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

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

 27:     PetscInt ngradsteps;              /*  Number of gradient steps */
 28:     PetscInt nresetsteps;               /*  Number of reset steps */

 30:     PetscInt cg_type;           /*  Formula to use */
 31: } TAO_CG;

 33: #endif /* ifndef __TAO_CG_H */