- Main Page
- Related Pages
- Classes
- Files

- File List

# mcsearch.h

    00001 //
    00002 // mcsearch.h
    00003 //
    00004 // Based on line search routines found in lbfgs.f on the WWW.
    00005 //
    00006
    00007 #ifndef _math_optimize_mcsearch_h
    00008 #define _math_optimize_mcsearch_h
    00009
    00010 #ifdef __GNUC__
    00011 #pragma interface
    00012 #endif
    00013
    00014 #include <math/optimize/opt.h>
    00015 #include <util/misc/autovec.h>
    00016
    00017 namespace sc {
    00018
    00024 class MCSearch: public LineOpt {
    00025   protected:
    00026
    00027     // These are originally from the lb3 common block.
    00028     double gtol_, stpmin_, stpmax_;
    00029
    00030     // Local variables in mcsrch
    00031     double dg, fm, fx, fy, dgm, dgx, dgy, fxm, fym, stx, sty, dgxm,
    00032            dgym;
    00033     int infoc;
    00034     double finit, width, stmin, stmax;
    00035     bool stage1;
    00036     double width1, ftest1;
    00037     bool brackt;
    00038     double dginit, dgtest;
    00039
    00040     // Local variables in mcstep
    00041     double p, q, r__, s, sgnd, stpc, stpf, stpq, gamma, theta;
    00042     bool bound;
    00043
    00044     // these are saved from call to call
    00045     int info_;
    00046     auto_vec<double> wa_;
    00047
    00048     void
    00049     mcstep(double *stx, double *fx, double *dx,
    00050            double *sty, double *fy, double *dy, double *stp,
    00051            double *fp, double *dp, bool *brackt, double *stpmin,
    00052            double *stpmax, int *info);
    00053
    00054     void
    00055     mcsrch(int *n, double *x, double *f,
    00056            double *g, double *s, double *stp, double *ftol,
    00057            double *xtol, int *maxfev, int *info, int *nfev,
    00058            double *wa);
    00059
    00060
    00061     void mcinit();
    00062   public:
    00063
    00067     MCSearch(const Ref<KeyVal>&);
    00068     ~MCSearch();
    00069     int update();
    00070
    00071     void init(RefSCVector& direction);
    00072     void init(RefSCVector& direction, Ref<Function> function);
    00073
    00074 };
    00075
    00076 }
    00077
    00078 #endif
    00079
    00080 // Local Variables:
    00081 // mode: c++
    00082 // c-file-style: "CLJ"
    00083 // End: