BFGSFitter.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #include <map>
15 
16 #ifndef _BFGSFitter_H_
17 #define _BFGSFitter_H_
18 
19 #include "Fitter.h"
20 
21 namespace hippodraw {
22 
34 {
35 private:
36 
37  /* Using compiler generated copy constructor.
38  BFGSFitter ( const BFGSFitter & )
39  */
40 
42  std::vector< std::vector< double > > m_M;
43 
45  std::vector< double > m_xinit;
46 
50  double m_grad_cutoff;
51 
55  double m_step_cutoff;
56 
59  double m_proj_cutoff;
60 
77  double m_c1, m_c2;
78 
81  double m_alpha_max;
82 
85  double m_alpha1;
86 
88  std::map< std::string, double * > m_iter_params;
89 
90  public:
92  BFGSFitter ( const char * name );
93 
94  Fitter * clone () const;
95 
99  virtual int calcCovariance ( std::vector< std::vector < double > >& cov );
100 
104  double wolfeStep( const std::vector< double > & x0,
105  const std::vector< double > & p ) const;
106 
110  double zoom( const std::vector< double >& x0,
111  const std::vector< double >& p,
112  double phi0, double dphi0,
113  double Alphalo, double Alphahi ) const;
114 
116  double interpolate( const std::vector< double >& x0,
117  const std::vector< double >& p,
118  double Alphaim, double Alphai ) const;
119 
121  double function( const std::vector< double > & x ) const;
122 
124  std::vector< double > gradient( const std::vector< double > & x ) const;
125 
128  double gradp( const std::vector< double > & u,
129  const std::vector< double > & p ) const;
130 
132  const std::vector< double > & initIter() const;
133 
135  int setInitIter( const std::vector< double > & xinit );
136 
141  double iterParam( std::string name );
142 
147  int setIterParam( std::string name, double value );
148 
152  virtual bool calcBestFit();
153 
154 };
155 
156 } // namespace hippodraw
157 
158 #endif // _BFGSFitter_H_
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
double m_alpha_max
Maximum step length to try, suggested value by Nocedal and Wright is alpha_max = 4.
Definition: BFGSFitter.h:81
double m_alpha1
First step length to try and this must be less than Alpha_max.
Definition: BFGSFitter.h:85
The base class for fitters.
Definition: Fitter.h:33
double m_proj_cutoff
The projection cut-off parameter.
Definition: BFGSFitter.h:59
numeric::array clone(numeric::array arr)
Definition: num_util.cpp:412
The minimization algorithm used is a complementary quasi newton algorithm, with BFGS (Broyden-Fletche...
Definition: BFGSFitter.h:33
hippodraw::Fitter class interface
std::vector< std::vector< double > > m_M
The inverse of the quasi-Hessian.
Definition: BFGSFitter.h:42
double m_grad_cutoff
The gradient cut-off parameter.
Definition: BFGSFitter.h:50
double m_step_cutoff
The step cut-off parameter.
Definition: BFGSFitter.h:55
std::map< std::string, double * > m_iter_params
Map of the various iteration parameters to their name.
Definition: BFGSFitter.h:88
std::vector< double > m_xinit
The initial value to start the iteration from.
Definition: BFGSFitter.h:45

Generated for HippoDraw Class Library by doxygen