MPQC  3.0.0-alpha
mcsearch.h
1 //
2 // mcsearch.h
3 //
4 // Based on line search routines found in lbfgs.f on the WWW.
5 //
6 
7 #ifndef _math_optimize_mcsearch_h
8 #define _math_optimize_mcsearch_h
9 
10 #include <math/optimize/opt.h>
11 #include <util/misc/autovec.h>
12 
13 namespace sc {
14 
20 class MCSearch: public LineOpt {
21  protected:
22 
23  // These are originally from the lb3 common block.
24  double gtol_, stpmin_, stpmax_;
25 
26  // Local variables in mcsrch
27  double dg, fm, fx, fy, dgm, dgx, dgy, fxm, fym, stx, sty, dgxm,
28  dgym;
29  int infoc;
30  double finit, width, stmin, stmax;
31  bool stage1;
32  double width1, ftest1;
33  bool brackt;
34  double dginit, dgtest;
35 
36  // Local variables in mcstep
37  double p, q, r__, s, sgnd, stpc, stpf, stpq, gamma, theta;
38  bool bound;
39 
40  // these are saved from call to call
41  int info_;
42  auto_vec<double> wa_;
43 
44  void
45  mcstep(double *stx, double *fx, double *dx,
46  double *sty, double *fy, double *dy, double *stp,
47  double *fp, double *dp, bool *brackt, double *stpmin,
48  double *stpmax, int *info);
49 
50  void
51  mcsrch(int *n, double *x, double *f,
52  double *g, double *s, double *stp, double *ftol,
53  double *xtol, int *maxfev, int *info, int *nfev,
54  double *wa);
55 
56 
57  void mcinit();
58  public:
59 
63  MCSearch(const Ref<KeyVal>&);
64  MCSearch();
65  ~MCSearch();
66  int update();
67 
68  void init(RefSCVector& direction);
69  void init(RefSCVector& direction, Ref<Function> function);
70 
71  void print(std::ostream& = ExEnv::out0()) const;
72 };
73 
74 }
75 
76 #endif
77 
78 // Local Variables:
79 // mode: c++
80 // c-file-style: "CLJ"
81 // End:
sc::LineOpt
The LineOpt abstract class is used to perform one dimensional optimizations.
Definition: opt.h:125
sc::Optimize::init
void init()
Initialize the optimizer.
sc::MCSearch
This performs line searches with cubic steps.
Definition: mcsearch.h:20
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::auto_vec< double >
sc::MCSearch::update
int update()
Take a step.
sc::RefSCVector
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition: matrix.h:55
sc::MCSearch::print
void print(std::ostream &=ExEnv::out0()) const
Print the object.
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:24:00 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.