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();
74 std::vector<double> & h =
Hessian();
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];
virtual const std::vector< double > & GetMeasurement(int Index) const
Accessor to the position of the measurement (x coordinate).
virtual void SetParameters(const std::vector< double > ¶ms) const
Sets the parameters of the ParametricFunction.
std::vector< std::vector< double > > fPositions
Namespace for new ROOT classes and functions.
void SetFCNValue(double value)
const ParametricFunction * ModelFunction() const
Returns the model function used for the data.
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 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...
virtual int GetNumberOfMeasurements() const
Accessor to the number of measurements used for calculating the chi-square.
std::vector< double > & Hessian()
std::vector< double > fMeasurements
virtual void EvaluateAll(const std::vector< double > &par)
Evaluate function Value, Gradient and Hessian using Fumili approximation, for values of parameters p ...
Function which has parameters.
virtual const std::vector< double > & Gradient() const
Return cached Value of function Gradient estimated previously using the FumiliFCNBase::EvaluateAll me...
std::vector< double > fInvErrors