Actual source code: taocg.h
1: /*
2: Context for conjugate gradient method (unconstrained minimization)
3: */
5: #pragma once
7: #include <petsc/private/taoimpl.h>
9: typedef struct {
10: Vec G_old;
11: Vec X_old;
12: Vec W; /* work vector */
14: PetscReal eta; /* Restart tolerance */
15: PetscReal delta_max; /* Minimum value for scaling */
16: PetscReal delta_min; /* Maximum value for scaling */
18: /* The algorithm restarts when the gradient at the current point g_k,
19: and the gradient of the previous point, g_{k-1}, satisfy the
20: following inequality:
22: abs(inner(g_k, g_{k-1})) > eta * norm(g_k, 2)^2. */
24: PetscInt ngradsteps; /* Number of gradient steps */
25: PetscInt nresetsteps; /* Number of reset steps */
27: PetscInt cg_type; /* Formula to use */
28: } TAO_CG;