48 if (computeD1_ && variables_.size() > 0)
51 function1_->enableFirstOrderDerivatives(
false);
53 function2_->enableSecondOrderDerivatives(
false);
54 function_->setParameters(parameters);
55 f1_ = function_->getValue();
57 bool functionChanged =
false;
59 for (
unsigned int i = 0; i < variables_.size(); i++)
61 string var = variables_[i];
62 if (!parameters.hasParameter(var))
67 vector<string> vars(2);
71 functionChanged =
true;
78 functionChanged =
true;
82 double h = (1 + std::abs(value)) * h_;
86 p[0].setValue(value + h);
88 f2_ = function_->getValue();
95 p[0].setValue(value - h);
97 f2_ = function_->getValue();
98 der1_[i] = (f1_ - f2_) / h;
107 der1_[i] = (f2_ - f1_) / h;
111 function1_->enableFirstOrderDerivatives(computeD1_);
113 function_->setParameters(parameters.subList(lastVar));
119 function1_->enableFirstOrderDerivatives(computeD1_);
121 function2_->enableSecondOrderDerivatives(computeD2_);
123 function_->setParameters(parameters);
124 f1_ = function_->getValue();
Exception thrown when a parameter is not found, for instance in a ParameterList.
virtual ParameterList subList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
void updateDerivatives(const ParameterList parameters)
Compute derivatives.
virtual double getParameterValue(const std::string &name) const
Get the value of the parameter with name name.
This class allows to perform a correspondence analysis.
The parameter list object.
virtual void setParameters(const ParameterList ¶ms)
Update the parameters from params.
Exception thrown when a value do not match a given constraint.