Tomato
OxFitterLevenbergMarquardtLmfit.hxx
1 
7 #ifndef Tomato_OXFITTERLEVENBERGMARQUARDTLMFIT_HXX
8 #define Tomato_OXFITTERLEVENBERGMARQUARDTLMFIT_HXX
9 
10 #include "CmakeConfigForTomato.h"
11 #ifdef USE_LMFIT
12 
13 #include "OxFitter.h"
15 #include "lmmin.h"
16 
17 namespace Ox {
18 
19  template < typename TYPE >
20  int
21  FitterLevenbergMarquardtLmfit<TYPE>
22  ::performFitting(){
23 
24  lm_control_struct control = lm_control_double;
25  lm_status_struct status;
26 
27  // TODO: move to constructor to make it faster
28  control.patience = this->getMaxFunctionEvals();
29  control.ftol = this->getFTolerance();
30  control.xtol = this->getXTolerance();
31  //control.gtol = this->GetGTolerance();
32 
33  if (this->getVerbose()){
34  control.verbosity = 1;
35  }
36 
37  if (this->getTrace()){
38  control.verbosity = 3;
39  }
40 
41  lmmin(
42  this->_Model->getNDims(),
43  this->getParameters(),
44  this->_Model->getNSamples(),
45  NULL,
46  (const void *)this->_Model,
47  ModelT1AdapterLmfitLeastSquares<TYPE>::calcLSResiduals,
48  &control,
49  &status);
50 
51  return 0; //EXIT_SUCCESS;
52  }
53 
54  template < typename TYPE >
55  void
56  FitterLevenbergMarquardtLmfit<TYPE>
57  ::disp(){
58  std::cout << "\nYou called disp() on a FitterLevenbergMarquardtLmfit object " << this << "\n";
59  std::cout << "It's base class is as follows: ";
60 
62  }
63 
64 } // namespace Ox
65 
66 #endif //USE_LMFIT
67 
68 #endif //Tomato_OXFITTERLEVENBERGMARQUARDTLMFIT_HXX
virtual void disp()
show me your Fitter
Definition: OxFitter.h:77
Definition: OxCalculator.h:19