26 std::vector<double> result;
28 unsigned int fPositionsSize =
fPositions.size();
31 for(
unsigned int i=0; i < fPositionsSize; i++) {
33 const std::vector<double> & currentPosition =
fPositions[i];
73 std::vector<double> & grad =
Gradient();
75 int npar = par.size();
78 h.resize(
static_cast<unsigned int>(0.5 * npar* (npar + 1) ) );
80 grad.assign(npar, 0.0);
81 h.assign(
static_cast<unsigned int>(0.5 * npar* (npar + 1) ) , 0.0);
86 for (
int i = 0; i < nmeas; ++i) {
89 const std::vector<double> & currentPosition =
fPositions[i];
92 double fval = modelFunc(par);
95 chi2 += element*element;
100 std::vector<double> mfg = modelFunc.
GetGradient(par);
103 for (
int j = 0; j < npar ; ++j) {
104 double dfj = invError * mfg[j];
105 grad[j] += 2.0 * element * dfj;
109 for (
int k = j; k < npar; ++ k) {
110 int idx = j + k*(k+1)/2;
111 h[idx] += 2.0 * dfj * invError * mfg[k];
const ParametricFunction * ModelFunction() const
Returns the model function used for the data.
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)
virtual int GetNumberOfMeasurements() const
Accessor to the number of measurements used for calculating the chi-square.
std::vector< double > fInvErrors
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
std::vector< double > fMeasurements
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 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...