49 if (computeD1_ && variables_.size() > 0)
52 function1_->enableFirstOrderDerivatives(
false);
54 function2_->enableSecondOrderDerivatives(
false);
55 function_->setParameters(parameters);
56 f1_ = function_->getValue();
58 bool functionChanged =
false;
60 for (
unsigned int i = 0; i < variables_.size(); i++)
62 string var = variables_[i];
68 vector<string> vars(2);
72 functionChanged =
true;
79 functionChanged =
true;
83 double h = (1 + std::abs(value)) * h_;
87 p[0].setValue(value + h);
89 f2_ = function_->getValue();
96 p[0].setValue(value - h);
98 f2_ = function_->getValue();
99 der1_[i] = (f1_ - f2_) / h;
108 der1_[i] = (f2_ - f1_) / h;
112 function1_->enableFirstOrderDerivatives(computeD1_);
120 function1_->enableFirstOrderDerivatives(computeD1_);
122 function2_->enableSecondOrderDerivatives(computeD2_);
124 function_->setParameters(parameters);
125 f1_ = function_->getValue();
Exception thrown when a value do not match a given constraint.
The parameter list object.
virtual bool hasParameter(const std::string &name) const
virtual void setParameters(const ParameterList ¶ms)
Update the parameters from params.
virtual double getParameterValue(const std::string &name) const
Get the value of the parameter with name name.
virtual ParameterList createSubList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
void updateDerivatives(const ParameterList parameters)
Compute derivatives.