ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
line_search.h
Go to the documentation of this file.
1#ifndef LINE_SEARCH_H
2#define LINE_SEARCH_H
3
5{
6 public:
9
10 bool line_search(const bool restart, // whether to restart line search (when cg direction has changed)
11 const double x, // position for function at x
12 const double y, // value of function at x
13 const double f, // gradient of function at x
14 double& xnew, // postion where function has to be evaluated
15 const double conv_thr); // predicted change of function value of function at xnew
16
17 bool first_order(const double x, const double y, const double f, double& xnew);
18
19 bool third_order(const double x, const double y, const double f, double& xnew, const double conv_thr);
20
21 void init_brent(const double x, const double y, const double f);
22
23 void update_brent(const double x, const double y, const double f);
24
25 bool brent(const double x, const double y, const double f, double& xnew, const double conv_thr);
26
27 private:
28 int ls_step = 0; // step of line search
29 bool bracked = false; // whether the minima is bracked by [a,c]
31 double xa = 0.0;
32 double xb = 0.0;
33 double xc = 0.0;
34 double fa = 0.0;
35 double fb = 0.0;
36 double fc = 0.0;
37 double ya = 0.0;
38 double yb = 0.0;
40 double fstart = 0.0; // keep record of initial gradient for brent method
41 const double e8 = 1.0e-8;
42};
43
44#endif
Definition line_search.h:5
double xb
Definition line_search.h:32
int ls_step
Definition line_search.h:28
~Line_Search()
Definition line_search.h:8
double fb
Definition line_search.h:35
const double e8
Definition line_search.h:41
void update_brent(const double x, const double y, const double f)
Definition line_search.cpp:178
double fstart
Definition line_search.h:40
double xa
these variables used to keep record of some points
Definition line_search.h:31
double yb
Definition line_search.h:38
double ya
Definition line_search.h:37
bool third_order(const double x, const double y, const double f, double &xnew, const double conv_thr)
Definition line_search.cpp:56
bool first_order(const double x, const double y, const double f, double &xnew)
Definition line_search.cpp:46
void init_brent(const double x, const double y, const double f)
Definition line_search.cpp:128
Line_Search()
Definition line_search.h:7
bool line_search(const bool restart, const double x, const double y, const double f, double &xnew, const double conv_thr)
Definition line_search.cpp:8
double fc
Definition line_search.h:36
double fa
Definition line_search.h:34
bool bracked
Definition line_search.h:29
double xc
Definition line_search.h:33
bool brent(const double x, const double y, const double f, double &xnew, const double conv_thr)
Definition line_search.cpp:191