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