1 #ifndef __JFIT__JGANDALF__
2 #define __JFIT__JGANDALF__
22 namespace JPP {
using namespace JFIT; }
51 template<
class JModel_t>
53 public JMessage< JGandalf<JModel_t> >
86 const JModel_t& model) :
97 operator double()
const
126 template<
class JFunction_t,
class T,
class ...Args>
127 result_type
operator()(
const JFunction_t& fit,
T __begin,
T __end, Args ...args)
147 result_type precessor = result_type(numeric_limits<double>::max(),
value);
190 DEBUG(
"Hesse matrix:" << endl);
196 for (
int i = 0; i !=
N; ++i) {
202 h[i] = 1.0 / sqrt(
H(i,i));
208 for (
int i = 0; i !=
N; ++i) {
209 for (
int j = 0;
j != i; ++
j) {
210 H(
j,i) *=
h[i] *
h[
j];
215 for (
int i = 0; i !=
N; ++i) {
224 ERROR(
"JGandalf: " << error.
what() << endl);
229 for (
int i = 0; i !=
N; ++i) {
233 for (
int j = 0;
j !=
N; ++
j) {
285 template<
class JFunction_t,
class T,
class ...Args>
286 inline void __evaluate__(
const JFunction_t& fit,
T __begin,
T __end, Args ...args)
290 for (
T hit = __begin; hit != __end; ++hit) {
297 for (
unsigned int i = 0; i !=
parameters.size(); ++i) {
313 template<
class JFunction_t>
326 static inline double alias(
const T& model,
const typename T::parameter_type parameter)
328 return model.*parameter;
340 static inline double&
alias(
T& model,
const typename T::parameter_type parameter)
342 return model.*parameter;
354 static inline double alias(
const T& model,
const size_t index)
368 static inline double&
alias(
T& model,
const size_t index)
382 static inline double alias(
const T& model,
const int index)
396 static inline double&
alias(
T& model,
const int index)
411 template<
class JModel_t>
418 template<
class JModel_t>
425 template<
class JModel_t>
432 template<
class JModel_t>
439 template<
class JModel_t>
446 template<
class JModel_t>
453 template<
class JModel_t>
static int debug
debug level (default is off).
static double EPSILON
maximal distance to minimum
static double PIVOT
minimal value diagonal element of matrix
static const JZero zero
Function object to assign zero value.
JMatrixND & reset()
Set matrix to the null matrix.
Auxiliary data structure for floating point format specification.
std::vector< parameter_type > parameters
void resize(const size_t size)
Resize matrix.
static double LAMBDA_MIN
minimal value control parameter
static double LAMBDA_DOWN
multiplication factor control parameter
Definition of zero value for any class.
static double alias(const T &model, const size_t index)
Read/write access to parameter value by index.
I/O formatting auxiliaries.
static double & alias(T &model, const size_t index)
Read/write access to parameter value by index.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JModel_t gradient
d(chi2)/d(...)
result_type operator()(const JFunction_t &fit, T __begin, T __end, Args...args)
Multi-dimensional fit of two data sets.
static double alias(const T &model, const int index)
Read/write access to parameter value by index.
General purpose messaging.
static double alias(const T &model, const typename T::parameter_type parameter)
Read/write access to parameter value by data member.
static double LAMBDA_UP
multiplication factor control parameter
void invert()
Invert matrix according LDU decomposition.
Fit method based on the Levenberg-Marquardt method.
void __evaluate__(const JFunction_t &fit, T __begin, T __end, Args...args)
Recursive method for evaluation of fit.
void __evaluate__(const JFunction_t &fit)
Termination method for evaluation of fit.
Data structure for return value of fit function.
result_type(const double chi2, const JModel_t &model)
Constructor.
static double & alias(T &model, const int index)
Read/write access to parameter value by index.
static int MAXIMUM_ITERATIONS
maximal number of iterations
static double LAMBDA_MAX
maximal value control parameter
virtual const char * what() const
Get error message.
result_type()
Default constructor.
Auxiliary data structure for floating point format specification.
then usage $script[input file[working directory[option]]] nWhere option can be N
static double & alias(T &model, const typename T::parameter_type parameter)
Read/write access to parameter value by data member.
JModel_t::parameter_type parameter_type
Data type of fit parameter.
#define DEBUG(A)
Message macros.
Auxiliary class for handling debug parameter within a class.
JGandalf()
Default constructor.