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)
 
  142       previous.result.chi2 = numeric_limits<double>::max();
 
  146       current.result.chi2     = numeric_limits<double>::max();
 
  164         update(fit, __begin, __end, args...);
 
  202           update(fit, __begin, __end, args...);
 
  208         DEBUG(
"Hesse matrix:" << endl << 
V << endl);
 
  213         for (
size_t i = 0; i != 
N; ++i) {
 
  219           h[i] = 1.0 / sqrt(
V(i,i));
 
  225         for (
size_t row = 0; row != 
N; ++row) {
 
  226           for (
size_t col = 0; col != row; ++col) {
 
  227             V(row,col) *= 
h[row] * 
h[col];
 
  228             V(col,row)  = 
V(row,col);
 
  232         for (
size_t i = 0; i != 
N; ++i) {
 
  244           ERROR(
"JGandalf: " << error.
what() << endl << 
V << endl);
 
  252         for (
size_t row = 0; row != 
N; ++row) {
 
  256           for (
size_t col = 0; col != 
N; ++col) {
 
  258             V(row,col) *= 
h[row] * 
h[col];
 
  318     template<
class JFunction_t, 
class T, 
class ...Args>
 
  319     inline void update(
const JFunction_t& fit, T __begin, T __end, Args ...args)
 
  321       for (T i = __begin; i != __end; ++i) {
 
  325         current.result.chi2     += result.chi2;
 
  326         current.result.gradient += result.gradient;
 
  328         for (
size_t row = 0; row != 
parameters.size(); ++row) {
 
  329           for (
size_t col = row; col != 
parameters.size(); ++col) {
 
  344     template<
class JFunction_t>
 
  345     inline void update(
const JFunction_t& fit)
 
  347       for (
size_t row = 0; row != 
parameters.size(); ++row) {
 
  348         for (
size_t col = 0; col != row; ++col) {
 
  362     static inline double get(
const JModel_t& model, 
double JModel_t::*parameter)
 
  364       return model.*parameter;
 
  375     static inline double& 
get(JModel_t& model, 
double JModel_t::*parameter)
 
  377       return model.*parameter;
 
  388     static inline double get(
const JModel_t& model, 
const size_t index)
 
  401     static inline double& 
get(JModel_t& model, 
const size_t index)
 
  414     static inline double get(
const JModel_t& model, 
const int index)
 
  427     static inline double& 
get(JModel_t& model, 
const int index)
 
  451   template<
class JModel_t>
 
  458   template<
class JModel_t>
 
  465   template<
class JModel_t>
 
  472   template<
class JModel_t>
 
  479   template<
class JModel_t>
 
  486   template<
class JModel_t>
 
  493   template<
class JModel_t>
 
static int debug
debug level (default is off). 
 
double lambda
control parameter 
 
static double EPSILON
maximal distance to minimum 
 
static double PIVOT
minimal value diagonal element of Hesse matrix 
 
JMATH::JMatrixNS V
Hesse matrix. 
 
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
 
static const JZero zero
Function object to assign zero value. 
 
Auxiliary data structure for floating point format specification. 
 
std::vector< parameter_type > parameters
fit 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. 
 
void reset()
Reset current parameters. 
 
struct JFIT::JGandalf::@13 previous
 
void update(const JFunction_t &fit)
Termination method to update current parameters. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
JModel_t gradient
partial derivatives of chi2 
 
result_type operator()(const JFunction_t &fit, T __begin, T __end, Args...args)
Multi-dimensional fit of multiple data sets. 
 
void update(const JFunction_t &fit, T __begin, T __end, Args...args)
Recursive method to update current parameters. 
 
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. 
 
Data structure for return value of fit function. 
 
result_type(const double chi2, const JModel_t &model)
Constructor. 
 
void swap(JMatrixND_t &A)
Swap matrices. 
 
static int MAXIMUM_ITERATIONS
maximal number of iterations 
 
int numberOfIterations
number of iterations 
 
static double LAMBDA_MAX
maximal value control parameter 
 
struct JFIT::JGandalf::@12 current
 
result_type()
Default constructor. 
 
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.