Jpp 19.3.0-rc.3
the software that should make you happy
|
Fit method based on the Levenberg-Marquardt method. More...
#include <JGandalf.hh>
Classes | |
struct | result_type |
Data structure for return value of fit function. More... | |
Public Types | |
typedef JFIT_LOCAL::JTypedef_t< JModel_t >::parameter_type | parameter_type |
Data type of fit parameter. | |
Public Member Functions | |
JGandalf () | |
Default constructor. | |
template<class JFunction_t , class T , class ... Args> | |
result_type | operator() (const JFunction_t &fit, T __begin, T __end, Args ...args) |
Multi-dimensional fit of multiple data sets. | |
Public Attributes | |
std::vector< parameter_type > | parameters |
fit parameters | |
int | numberOfIterations |
number of iterations | |
double | lambda |
control parameter | |
JModel_t | value |
value | |
JModel_t | error |
error | |
JMATH::JMatrixNS | V |
Hesse matrix. | |
Static Public Attributes | |
static int | MAXIMUM_ITERATIONS = 1000 |
maximal number of iterations | |
static double | EPSILON = 1.0e-3 |
maximal distance to minimum | |
static bool | EPSILON_ABSOLUTE = false |
set epsilon to absolute difference instead of relative | |
static double | LAMBDA_MIN = 0.01 |
minimal value control parameter | |
static double | LAMBDA_MAX = 100.0 |
maximal value control parameter | |
static double | LAMBDA_UP = 10.0 |
multiplication factor control parameter | |
static double | LAMBDA_DOWN = 10.0 |
multiplication factor control parameter | |
static double | PIVOT = std::numeric_limits<double>::epsilon() |
minimal value diagonal element of Hesse matrix | |
static int | debug = 0 |
debug level (default is off). | |
Private Member Functions | |
void | reset () |
Reset current parameters. | |
template<class JFunction_t , class T , class ... Args> | |
void | update (const JFunction_t &fit, T __begin, T __end, Args ...args) |
Recursive method to update current parameters. | |
template<class JFunction_t > | |
void | update (const JFunction_t &fit) |
Termination method to update current parameters. | |
Static Private Member Functions | |
static double | get (const JModel_t &model, double JModel_t::*parameter) |
Read/write access to parameter value by data member. | |
static double & | get (JModel_t &model, double JModel_t::*parameter) |
Read/write access to parameter value by data member. | |
static double | get (const JModel_t &model, const size_t index) |
Read/write access to parameter value by index. | |
static double & | get (JModel_t &model, const size_t index) |
Read/write access to parameter value by index. | |
static double | get (const JModel_t &model, const int index) |
Read/write access to parameter value by index. | |
static double & | get (JModel_t &model, const int index) |
Read/write access to parameter value by index. | |
Private Attributes | ||
std::vector< double > | h | |
JMATH::JVectorND | x | |
struct { | ||
result_type result | ||
} | current | |
struct { | ||
JModel_t value | ||
result_type result | ||
} | previous | |
Fit method based on the Levenberg-Marquardt method.
The template argument refers to the model that should be fitted to the data.
This data structure should have arithmetic capabilities.
The data member JGandalf::value corresponds to the start c.q. final value of the model of the fit procedure and JGandalf::error to the uncertainties.
The co-variance matrix is stored in data member JGandalf::V.
The data member JGandalf::parameters constitutes a list of those parameters of the model that should actually be fitted.
For this, the model should contain the type definition for parameter_type
.
Normally, this type definition corresponds to a pointer to a data member of the model.
If not defined, the parameters are assumed to be data members of type double
.
Alternatively, the type definition can be size_t
or int
.
In that case, the model should provide for the element access operator[]
.
The first template parameter in the function operator should provide for an implementation of the actual fit function.
This function should return the data type JGandalf::result_type.
This data structure comprises the values of the chi2 and the gradient for a given data point.
The function operator returns the minimal chi2 and summed gradient of all data points.
Definition at line 85 of file JGandalf.hh.
JFIT_LOCAL::JTypedef_t<JModel_t>::parameter_type JFIT::JGandalf< JModel_t >::parameter_type |
Data type of fit parameter.
Definition at line 96 of file JGandalf.hh.
|
inline |
|
inline |
Multi-dimensional fit of multiple data sets.
The fit function should return the chi2 as well as the partial derivatives for the current value of the model and a given data point.
fit | fit function |
__begin | begin of data |
__end | end of data |
args | optional data |
Definition at line 161 of file JGandalf.hh.
|
inlineprivate |
Reset current parameters.
Definition at line 350 of file JGandalf.hh.
|
inlineprivate |
Recursive method to update current parameters.
fit | fit function |
__begin | begin of data |
__end | end of data |
args | optional data |
Definition at line 370 of file JGandalf.hh.
|
inlineprivate |
Termination method to update current parameters.
fit | fit function |
Definition at line 396 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by data member.
model | model |
parameter | parameter |
Definition at line 413 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by data member.
model | model |
parameter | parameter |
Definition at line 426 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by index.
model | model |
index | index |
Definition at line 439 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by index.
model | model |
index | index |
Definition at line 452 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by index.
model | model |
index | index |
Definition at line 465 of file JGandalf.hh.
|
inlinestaticprivate |
Read/write access to parameter value by index.
model | model |
index | index |
Definition at line 478 of file JGandalf.hh.
|
static |
maximal number of iterations
maximal number of iterations.
Definition at line 330 of file JGandalf.hh.
|
static |
maximal distance to minimum
maximal distance to minimum.
Definition at line 331 of file JGandalf.hh.
|
static |
set epsilon to absolute difference instead of relative
set epsilon to absolute difference instead of relative.
Definition at line 332 of file JGandalf.hh.
|
static |
minimal value control parameter
Definition at line 333 of file JGandalf.hh.
|
static |
maximal value control parameter
Definition at line 334 of file JGandalf.hh.
|
static |
multiplication factor control parameter
Definition at line 335 of file JGandalf.hh.
|
static |
multiplication factor control parameter
Definition at line 336 of file JGandalf.hh.
|
static |
minimal value diagonal element of Hesse matrix
minimal value diagonal element of matrix
Definition at line 337 of file JGandalf.hh.
std::vector<parameter_type> JFIT::JGandalf< JModel_t >::parameters |
fit parameters
Definition at line 339 of file JGandalf.hh.
int JFIT::JGandalf< JModel_t >::numberOfIterations |
number of iterations
Definition at line 340 of file JGandalf.hh.
double JFIT::JGandalf< JModel_t >::lambda |
control parameter
Definition at line 341 of file JGandalf.hh.
JModel_t JFIT::JGandalf< JModel_t >::value |
value
Definition at line 342 of file JGandalf.hh.
JModel_t JFIT::JGandalf< JModel_t >::error |
error
Definition at line 343 of file JGandalf.hh.
JMATH::JMatrixNS JFIT::JGandalf< JModel_t >::V |
Hesse matrix.
Definition at line 344 of file JGandalf.hh.
|
private |
Definition at line 483 of file JGandalf.hh.
|
private |
Definition at line 484 of file JGandalf.hh.
result_type JFIT::JGandalf< JModel_t >::result |
Definition at line 487 of file JGandalf.hh.
struct { ... } JFIT::JGandalf< JModel_t >::current |
struct { ... } JFIT::JGandalf< JModel_t >::previous |
|
staticinherited |
debug level (default is off).
Definition at line 45 of file JMessage.hh.