Base class for conjugate gradient optimization algorithms.
More...
#include <cg_base.h>
|
| void | setup_cg_grad (const int dim, double *grad, const double *grad0, double *cg_grad, const double *cg_grad0, const int &ncggrad, int &flag) |
| | Setup conjugate gradient direction.
|
| void | Brent (double &fa, double &fb, double &fc, double &xa, double &xb, double &xc, double &best_x, double &xpt) |
| | Brent's method for one-dimensional minimization.
|
| void | third_order (const double &e0, const double &e1, const double &fa, const double &fb, const double x, double &best_x) |
| | Third-order polynomial interpolation for line search.
|
| void | f_cal (const int dim, const double *g0, const double *g1, double &f_value) |
| | Calculate projection of gradient onto search direction.
|
| void | setup_move (const int dim, double *move, double *cg_gradn, const double &trust_radius) |
| | Calculate movement vector from CG direction.
|
|
| void | normalize (const int dim, double *cg_gradn, const double *cg_grad) |
| | Normalize vector.
|
Base class for conjugate gradient optimization algorithms.
This class provides common CG utility functions that can be shared between different optimization implementations (ions movement and lattice change). The functions are designed to be independent of specific data sources.
◆ Brent()
| void CG_Base::Brent |
( |
double & | fa, |
|
|
double & | fb, |
|
|
double & | fc, |
|
|
double & | xa, |
|
|
double & | xb, |
|
|
double & | xc, |
|
|
double & | best_x, |
|
|
double & | xpt ) |
Brent's method for one-dimensional minimization.
- Parameters
-
| fa | Function value at xa |
| fb | Function value at xb |
| fc | Function value at xc |
| xa | Left bound |
| xb | Middle point |
| xc | Right bound |
| best_x | Output best step length |
| xpt | Previous best point |
◆ f_cal()
| void CG_Base::f_cal |
( |
const int | dim, |
|
|
const double * | g0, |
|
|
const double * | g1, |
|
|
double & | f_value ) |
Calculate projection of gradient onto search direction.
- Parameters
-
| dim | Dimension of vectors |
| g0 | First vector (usually search direction) |
| g1 | Second vector (usually gradient) |
| f_value | Output projection value |
◆ normalize()
| void CG_Base::normalize |
( |
const int | dim, |
|
|
double * | cg_gradn, |
|
|
const double * | cg_grad ) |
|
protected |
Normalize vector.
- Parameters
-
| dim | Dimension of vector |
| cg_gradn | Output normalized vector |
| cg_grad | Input vector |
◆ setup_cg_grad()
| void CG_Base::setup_cg_grad |
( |
const int | dim, |
|
|
double * | grad, |
|
|
const double * | grad0, |
|
|
double * | cg_grad, |
|
|
const double * | cg_grad0, |
|
|
const int & | ncggrad, |
|
|
int & | flag ) |
Setup conjugate gradient direction.
- Parameters
-
| dim | Dimension of the optimization problem |
| grad | Current gradient |
| grad0 | Previous gradient |
| cg_grad | Output CG direction |
| cg_grad0 | Previous CG direction |
| ncggrad | CG iteration counter |
| flag | Restart flag |
◆ setup_move()
| void CG_Base::setup_move |
( |
const int | dim, |
|
|
double * | move, |
|
|
double * | cg_gradn, |
|
|
const double & | trust_radius ) |
Calculate movement vector from CG direction.
- Parameters
-
| dim | Dimension of the optimization problem |
| move | Output movement vector |
| cg_gradn | Normalized CG direction |
| trust_radius | Step size limit |
◆ third_order()
| void CG_Base::third_order |
( |
const double & | e0, |
|
|
const double & | e1, |
|
|
const double & | fa, |
|
|
const double & | fb, |
|
|
const double | x, |
|
|
double & | best_x ) |
Third-order polynomial interpolation for line search.
- Parameters
-
| e0 | Energy at previous step |
| e1 | Energy at current step |
| fa | Gradient projection at previous step |
| fb | Gradient projection at current step |
| x | Current step length |
| best_x | Output optimal step length |
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_relax/cg_base.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_relax/cg_base.cpp