41 #ifndef BPP_NUMERIC_FUNCTION_FUNCTIONS_H
42 #define BPP_NUMERIC_FUNCTION_FUNCTIONS_H
45 #include "../AbstractParametrizable.h"
46 #include "../ParameterExceptions.h"
47 #include "../ParameterList.h"
48 #include "../Parametrizable.h"
51 #include "../../Clonable.h"
52 #include "../../Exceptions.h"
255 virtual double d2f(
const std::string& variable1,
const std::string& variable2,
const ParameterList& parameters)
587 double d2f(
const std::string& variable1,
const std::string& variable2,
const ParameterList& parameters)
623 return x * x + y * y;
A partial implementation of the Parametrizable interface.
virtual void addParameter_(Parameter *parameter)
const Parameter & getParameter(const std::string &name) const
Get the parameter with specified name.
bool matchParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
The Clonable interface (allow an object to be cloned).
Exception thrown when a value do not match a given constraint.
General class that wraps a function into another one. This class is meant to be derivated and just pr...
double getFirstOrderDerivative(const std::string &variable) const
Get the derivative of the function at the current point.
bool enableFirstOrderDerivatives() const
Tell if derivatives must be computed.
void enableFirstOrderDerivatives(bool yn)
Tell if derivatives must be computed.
DerivableFirstOrderWrapper(DerivableFirstOrder *function)
This is the abstract class for first order derivable functions.
virtual double getFirstOrderDerivative(const std::string &variable) const =0
Get the derivative of the function at the current point.
virtual void enableFirstOrderDerivatives(bool yn)=0
Tell if derivatives must be computed.
virtual double df(const std::string &variable, const ParameterList ¶meters)
Get the value of the first derivative of the function according to a given set of parameters.
virtual ~DerivableFirstOrder()
virtual bool enableFirstOrderDerivatives() const =0
Tell if derivatives must be computed.
DerivableFirstOrder * clone() const =0
Create a copy of this object and send a pointer to it.
General class that wraps a function into another one. This class is meant to be derivated and just pr...
bool enableSecondOrderDerivatives() const
Tell if derivatives must be computed.
void enableSecondOrderDerivatives(bool yn)
Tell if derivatives must be computed.
double getSecondOrderDerivative(const std::string &variable) const
Get the second order derivative of the function at the current point.
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.
DerivableSecondOrderWrapper(DerivableSecondOrder *function)
This is the abstract class for second order derivable functions.
DerivableSecondOrder * clone() const =0
Create a copy of this object and send a pointer to it.
virtual double d2f(const std::string &variable, const ParameterList ¶meters)
Get the value of the second order derivative of the function according to a given set of parameters.
virtual double getSecondOrderDerivative(const std::string &variable) const =0
Get the second order derivative of the function at the current point.
virtual ~DerivableSecondOrder()
virtual double getSecondOrderDerivative(const std::string &variable1, const std::string &variable2) const =0
Get the value of the cross derivative of the function according to a given set of parameters.
virtual void enableSecondOrderDerivatives(bool yn)=0
Tell if derivatives must be computed.
virtual bool enableSecondOrderDerivatives() const =0
Tell if derivatives must be computed.
virtual double d2f(const std::string &variable1, const std::string &variable2, const ParameterList ¶meters)
Get the value of the cross derivative of the function according to a given set of parameters.
General class that wraps a function into another one. This class is meant to be derivated and just pr...
FunctionWrapper & operator=(const FunctionWrapper &fw)
FunctionWrapper(const FunctionWrapper &fw)
const Parameter & getParameter(const std::string &name) const
Get the parameter with specified name.
void setParameters(const ParameterList ¶meters)
Set the point where the function must be computed.
FunctionWrapper(Function *function)
void setNamespace(const std::string &prefix)
Set the namespace for the parameter names.
void setAllParametersValues(const ParameterList ¶meters)
Set the parameters values to be equals to those of parameters.
std::string getNamespace() const
double getValue() const
Get the value of the function at the current point.
void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
double f(const ParameterList ¶meters)
Get the value of the function according to a given set of parameters.
size_t getNumberOfParameters() const
Get the number of parameters.
std::string getParameterNameWithoutNamespace(const std::string &name) const
Resolves a parameter name according to the current namespace.
void setParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
double getParameterValue(const std::string &name) const
Get the value for parameter of name 'name'.
const ParameterList & getParameters() const
Get all parameters available.
bool hasParameter(const std::string &name) const
Tell if there is a parameter with specified name.
ParameterList & getParameters_()
Get all parameters available.
bool matchParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
This is the function abstract class.
virtual double getValue() const =0
Get the value of the function at the current point.
virtual void setParameters(const ParameterList ¶meters)=0
Set the point where the function must be computed.
virtual double f(const ParameterList ¶meters)
Get the value of the function according to a given set of parameters.
Wrapper class for optimization under constraints.
InfinityDerivableFirstOrderWrapper(DerivableFirstOrder *function)
double getFirstOrderDerivative(const std::string &variable) const
InfinityDerivableFirstOrderWrapper * clone() const
Create a copy of this object and send a pointer to it.
virtual ~InfinityDerivableFirstOrderWrapper()
double df(const std::string &variable, const ParameterList ¶meters)
Wrapper class for optimization under constraints.
double d2f(const std::string &variable, const ParameterList ¶meters)
InfinityDerivableSecondOrderWrapper(DerivableFirstOrder *function)
double getSecondOrderDerivative(const std::string &variable1, const std::string &variable2) const
InfinityDerivableSecondOrderWrapper * clone() const
Create a copy of this object and send a pointer to it.
double d2f(const std::string &variable1, const std::string &variable2, const ParameterList ¶meters)
virtual ~InfinityDerivableSecondOrderWrapper()
double getSecondOrderDerivative(const std::string &variable) const
Wrapper class for optimization under constraints.
void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
InfinityFunctionWrapper * clone() const
Create a copy of this object and send a pointer to it.
virtual ~InfinityFunctionWrapper()
void setParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
double f(const ParameterList ¶meters)
Get the value of the function according to a given set of parameters.
bool matchParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
double getValue() const
Get the value of the function at the current point.
InfinityFunctionWrapper(Function *function)
void setAllParametersValues(const ParameterList ¶meters)
Set the parameters values to be equals to those of parameters.
void setParameters(const ParameterList ¶meters)
Set the point where the function must be computed.
The parameter list object.
This class is designed to facilitate the manipulation of parameters.
virtual double getValue() const
Get the value of this parameter.
This is the interface for all objects that imply parameters.
virtual std::string getParameterNameWithoutNamespace(const std::string &name) const =0
Resolves a parameter name according to the current namespace.
virtual size_t getNumberOfParameters() const =0
Get the number of parameters.
virtual bool matchParametersValues(const ParameterList ¶meters)=0
Update the parameters from parameters.
virtual std::string getNamespace() const =0
virtual void setAllParametersValues(const ParameterList ¶meters)=0
Set the parameters values to be equals to those of parameters.
virtual double getParameterValue(const std::string &name) const =0
Get the value for parameter of name 'name'.
virtual const Parameter & getParameter(const std::string &name) const =0
Get the parameter with specified name.
virtual const ParameterList & getParameters() const =0
Get all parameters available.
virtual ParameterList & getParameters_()=0
Get all parameters available.
virtual bool hasParameter(const std::string &name) const =0
Tell if there is a parameter with specified name.
virtual void setParameterValue(const std::string &name, double value)=0
Set the value of parameter with name name to be equal to value.
virtual void setParametersValues(const ParameterList ¶meters)=0
Update the parameters from parameters.
virtual void setNamespace(const std::string &prefix)=0
Set the namespace for the parameter names.
A simple funciton with two parameters, mostly for testing and debugging :)
TestFunction(double x=0, double y=0)
Clonable * clone() const
Create a copy of this object and send a pointer to it.
double getValue() const
Get the value of the function at the current point.
void fireParameterChanged(const ParameterList ¶meters)
Notify the class when one or several parameters have changed.
void setParameters(const ParameterList ¶meters)
Set the point where the function must be computed.