40 #ifndef _ABSTRACTNUMERICALDERIVATIVE_H_ 41 #define _ABSTRACTNUMERICALDERIVATIVE_H_ 44 #include "../Matrix/Matrix.h" 75 mutable std::map<std::string, size_t>
index_;
173 std::map<std::string, size_t>::iterator it =
index_.find(variable);
175 else throw Exception(
"First order derivative not computed for variable " + variable +
".");
199 std::map<std::string, size_t>::iterator it =
index_.find(variable);
201 else throw Exception(
"Second order derivative not computed for variable " + variable +
".");
215 std::map<std::string, size_t>::iterator it1 =
index_.find(variable1);
216 std::map<std::string, size_t>::iterator it2 =
index_.find(variable2);
218 else throw Exception(
"Cross second order derivative not computed for variables " + variable1 +
" and " + variable2 +
".");
284 #endif //_ABSTRACTNUMERICALDERIVATIVE_H_ AbstractNumericalDerivative * clone() const =0
Create a copy of this object and send a pointer to it.
virtual bool matchParametersValues(const ParameterList ¶meters)=0
Update the parameters from parameters.
Exception thrown when a parameter is not found, for instance in a ParameterList.
void enableSecondOrderCrossDerivatives(bool yn)
double getFirstOrderDerivative(const std::string &variable) const
Get the derivative of the function at the current point.
double f(const ParameterList ¶meters)
Get the value of the function according to a given set of parameters.
virtual ParameterList subList(const std::vector< std::string > &names) const
Get given parameters as a sublist.
DerivableSecondOrder * function2_
virtual void setParameters(const ParameterList ¶meters)=0
Set the point where the function must be computed.
double getInterval() const
void setInterval(double h)
Set the interval value used in numerical approximation.
virtual void setParameterValue(const std::string &name, double value)=0
Set the value of parameter with name name to be equal to value.
void setParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
This class allows to perform a correspondence analysis.
AbstractNumericalDerivative(DerivableFirstOrder *function)
This is the function abstract class.
double getValue() const
Get the value of the function at the current point.
virtual const ParameterList & getParameters() const =0
Get all parameters available.
bool enableSecondOrderCrossDerivatives() const
virtual void setParametersValues(const ParameterList ¶meters)=0
Update the parameters from parameters.
double getSecondOrderDerivative(const std::string &variable1, const std::string &variable2) const
Get the value of the cross derivative of the function according to a given set of parameters...
RowMatrix< double > crossDer2_
std::vector< std::string > variables_
virtual double getSecondOrderDerivative(const std::string &variable) const =0
Get the second order derivative of the function at the current point.
Numerical derivative function wrapper, partial implementation.
virtual double getFirstOrderDerivative(const std::string &variable) const =0
Get the derivative of the function at the current point.
The parameter list object.
AbstractNumericalDerivative(const AbstractNumericalDerivative &ad)
bool matchParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
void enableFirstOrderDerivatives(bool yn)
Tell if derivatives must be computed.
void enableSecondOrderDerivatives(bool yn)
Tell if derivatives must be computed.
void resize(size_t nRows, size_t nCols)
Resize the matrix.
bool enableSecondOrderDerivatives() const
Tell if derivatives must be computed.
virtual void setAllParametersValues(const ParameterList ¶meters)=0
Set the parameters values to be equals to those of parameters.
General class that wraps a function into another one. This class is meant to be derivated and just pr...
void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
virtual ~AbstractNumericalDerivative()
std::map< std::string, size_t > index_
AbstractNumericalDerivative(DerivableSecondOrder *function)
void setAllParametersValues(const ParameterList ¶meters)
Set the parameters values to be equals to those of parameters.
void setParametersToDerivate(const std::vector< std::string > &variables)
Set the list of parameters to derivate.
virtual void updateDerivatives(const ParameterList parameters)=0
Compute derivatives.
This is the abstract class for second order derivable functions.
This is the abstract class for first order derivable functions.
std::vector< double > der2_
AbstractNumericalDerivative & operator=(const AbstractNumericalDerivative &ad)
Exception thrown when a value do not match a given constraint.
void setParameters(const ParameterList ¶meters)
Set the point where the function must be computed.
bool enableFirstOrderDerivatives() const
Tell if derivatives must be computed.
std::vector< double > der1_
FunctionWrapper & operator=(const FunctionWrapper &fw)
double getSecondOrderDerivative(const std::string &variable) const
Get the second order derivative of the function at the current point.
DerivableFirstOrder * function1_
AbstractNumericalDerivative(Function *function)