12 if (computeD1_ && variables_.size() > 0)
15 function1_->enableFirstOrderDerivatives(
false);
17 function2_->enableSecondOrderDerivatives(
false);
18 function_->setParameters(parameters);
19 f1_ = function_->getValue();
22 for (
size_t i = 0; i < variables_.size(); ++i)
31 bool functionChanged =
false;
34 for (
size_t i = 0; i < variables_.size(); ++i)
36 string var = variables_[i];
41 vector<string> vars(2);
52 functionChanged =
true;
54 double h = -(1. + std::abs(value)) * h_;
55 if (abs(h) < p[0].getPrecision())
56 h = h < 0 ? -p[0].getPrecision() : p[0].getPrecision();
58 unsigned int nbtry = 0;
65 p[0].setValue(value + h);
69 f2_ = function_->getValue();
86 der1_[i] = (f2_ - f1_) / h;
90 function1_->enableFirstOrderDerivatives(computeD1_);
98 function1_->enableFirstOrderDerivatives(computeD1_);
100 function2_->enableSecondOrderDerivatives(computeD2_);
102 function_->setParameters(parameters);
103 f1_ = function_->getValue();
virtual ParameterList createSubList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
virtual double getParameterValue(const std::string &name) const
Get the value of the parameter with name name.
The parameter list object.
virtual bool hasParameter(const std::string &name) const
void updateDerivatives(const ParameterList ¶meters) override
Compute derivatives.
virtual void setParameters(const ParameterList ¶ms)
Update the parameters from params.
Exception thrown when a value do not match a given constraint.