xref: /petsc/src/tao/unconstrained/impls/cg/taocg.h (revision 2f613bf53f46f9356e00a2ca2bd69453be72fc31)
1 /*
2     Context for conjugate gradient method (unconstrained minimization)
3  */
4 
5 #ifndef __TAO_CG_H
6 #define __TAO_CG_H
7 
8 #include <petsc/private/taoimpl.h>
9 
10 typedef struct {
11     Vec G_old;
12     Vec X_old;
13     Vec W; /*  work vector */
14 
15     PetscReal eta;         /*  Restart tolerance */
16     PetscReal delta_max;   /*  Minimum value for scaling */
17     PetscReal delta_min;   /*  Maximum value for scaling */
18 
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:
22 
23             abs(inner(g_k, g_{k-1})) > eta * norm(g_k, 2)^2. */
24 
25     PetscInt ngradsteps;              /*  Number of gradient steps */
26     PetscInt nresetsteps;               /*  Number of reset steps */
27 
28     PetscInt cg_type;           /*  Formula to use */
29 } TAO_CG;
30 
31 #endif /* ifndef __TAO_CG_H */
32 
33