27 std::vector<double> result;
29 unsigned int fPositionsSize =
fPositions.size();
32 for(
unsigned int i=0; i < fPositionsSize; i++) {
34 const std::vector<double> & currentPosition =
fPositions[i];
43 result.push_back(tmp1);
71 static double minDouble = 8.0*DBL_MIN;
72 static double minDouble2 =
std::sqrt(8.0*DBL_MIN);
73 static double maxDouble2 = 1.0/minDouble2;
77 std::vector<double> & grad =
Gradient();
79 int npar = par.size();
80 double logLikelihood = 0;
82 h.resize(
static_cast<unsigned int>(0.5 * npar* (npar + 1) ) );
83 grad.assign(npar, 0.0);
84 h.assign(
static_cast<unsigned int>(0.5 * npar* (npar + 1) ) , 0.0);
88 for (
int i = 0; i < nmeas; ++i) {
91 const std::vector<double> & currentPosition =
fPositions[i];
93 double fval = modelFunc(par);
94 if (fval < minDouble ) fval = minDouble;
96 double invFval = 1.0/fval;
98 std::vector<double> mfg = modelFunc.
GetGradient(par);
102 for (
int j = 0; j < npar; ++j) {
112 double dfj = invFval * mfg[j];
130 for (
int k = j; k < npar; ++ k) {
131 int idx = j + k*(k+1)/2;
139 double dfk = invFval * mfg[k];
std::vector< double > & Hessian()
virtual const std::vector< double > & Gradient() const
Return cached Value of function Gradient estimated previously using the FumiliFCNBase::EvaluateAll me...
void SetFCNValue(double value)
const ParametricFunction * ModelFunction() const
Returns the model function used for the data.
virtual int GetNumberOfMeasurements() const
Accessor to the number of measurements used for calculating the maximum likelihood.
std::vector< double > Elements(const std::vector< double > &par) const
Evaluates the model function for the different measurement points and the Parameter values supplied.
virtual void EvaluateAll(const std::vector< double > &par)
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
std::vector< std::vector< double > > fPositions
virtual const std::vector< double > & GetMeasurement(int Index) const
Accessor to the position of the measurement (x coordinate).
Function which has parameters.
virtual void SetParameters(const std::vector< double > ¶ms) const
Sets the parameters of the ParametricFunction.
virtual std::vector< double > GetGradient(const std::vector< double > &x) const
Member function returning the Gradient of the function with respect to its variables (but without inc...
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)