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
127 template<
class JFunction_t,
class T,
class ...Args>
128 result_type
operator()(
const JFunction_t& fit,
T __begin,
T __end, Args ...args)
148 result_type precessor = result_type(numeric_limits<double>::max(),
value);
191 DEBUG(
"Hesse matrix:" << endl);
197 for (
int i = 0; i !=
N; ++i) {
203 h[i] = 1.0 / sqrt(
V(i,i));
209 for (
int i = 0; i !=
N; ++i) {
210 for (
int j = 0;
j != i; ++
j) {
211 V(
j,i) *=
h[i] *
h[
j];
216 for (
int i = 0; i !=
N; ++i) {
225 ERROR(
"JGandalf: " << error.
what() << endl);
230 for (
int i = 0; i !=
N; ++i) {
234 for (
int j = 0;
j !=
N; ++
j) {
287 template<
class JFunction_t,
class T,
class ...Args>
288 inline void __evaluate__(
const JFunction_t& fit,
T __begin,
T __end, Args ...args)
292 for (
T hit = __begin; hit != __end; ++hit) {
299 for (
unsigned int i = 0; i !=
parameters.size(); ++i) {
315 template<
class JFunction_t>
327 static inline double alias(
const JModel_t& model,
double JModel_t::*parameter)
329 return model.*parameter;
340 static inline double&
alias(JModel_t& model,
double JModel_t::*parameter)
342 return model.*parameter;
353 static inline double alias(
const JModel_t& model,
const size_t index)
366 static inline double&
alias(JModel_t& model,
const size_t index)
379 static inline double alias(
const JModel_t& model,
const int index)
392 static inline double&
alias(JModel_t& model,
const int index)
407 template<
class JModel_t>
414 template<
class JModel_t>
421 template<
class JModel_t>
428 template<
class JModel_t>
435 template<
class JModel_t>
442 template<
class JModel_t>
449 template<
class JModel_t>
static int debug
debug level (default is off).
static double EPSILON
maximal distance to minimum
static double alias(const JModel_t &model, const size_t index)
Read/write access to parameter value by index.
static double PIVOT
minimal value diagonal element of matrix
static double alias(const JModel_t &model, double JModel_t::*parameter)
Read/write access to parameter value by data member.
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.
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 JModel_t &model, const int index)
Read/write access to parameter value by index.
General purpose messaging.
static double LAMBDA_UP
multiplication factor control parameter
void invert()
Invert matrix according LDU decomposition.
Fit method based on the Levenberg-Marquardt method.
virtual const char * what() const override
Get error message.
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 int MAXIMUM_ITERATIONS
maximal number of iterations
static double LAMBDA_MAX
maximal value control parameter
result_type()
Default constructor.
then usage $script[input file[working directory[option]]] nWhere option can be N
static double & alias(JModel_t &model, double JModel_t::*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.
static double & alias(JModel_t &model, const int index)
Read/write access to parameter value by index.
JGandalf()
Default constructor.
static double & alias(JModel_t &model, const size_t index)
Read/write access to parameter value by index.