Actual source code: cg.h
1: /*$Id$*/
3: /*
4: Context for conjugate gradient method (unconstrained minimization)
5: */
7: #ifndef __TAO_CG_H
10: #include "tao_solver.h"
12: typedef struct {
13: TaoVec *X2; // Solution vector
14: TaoVec *G1; // Gradient vector
15: TaoVec *G2; // Gradient vector
16: TaoVec *D; // Direction
17: TaoVec *W; // Work vector
19: double eta; // Restart tolerance
20: double delta_max; // Minimum value for scaling
21: double delta_min; // Maximum value for scaling
23: // The algorithm restarts when the gradient at the current point g_k,
24: // and the gradient of the previous point, g_{k-1}, satisfy the
25: // following inequality:
26: //
27: // abs(inner(g_k, g_{k-1})) > eta * norm(g_k, 2)^2.
29: int grad; // Number of gradient steps
30: int reset; // Number of reset steps
32: int cg_type; // Formula to use
33: } TAO_CG;
35: #endif