bpp-core3  3.0.0
bpp::FivePointsNumericalDerivative Class Referenceabstract

Five points numerical derivative function wrapper. More...

#include <Bpp/Numeric/Function/FivePointsNumericalDerivative.h>

+ Inheritance diagram for bpp::FivePointsNumericalDerivative:
+ Collaboration diagram for bpp::FivePointsNumericalDerivative:

Public Member Functions

 FivePointsNumericalDerivative (Function *function)
 
 FivePointsNumericalDerivative (DerivableFirstOrder *function)
 
 FivePointsNumericalDerivative (DerivableSecondOrder *function)
 
virtual ~FivePointsNumericalDerivative ()
 
FivePointsNumericalDerivativeclone () const
 Create a copy of this object and send a pointer to it. More...
 
double getValue () const
 Get the value of the function at the current point. More...
 
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. More...
 
void setInterval (double h)
 Set the interval value used in numerical approximation. More...
 
double getInterval () const
 
void setParametersToDerivate (const std::vector< std::string > &variables)
 Set the list of parameters to derivate numerically. More...
 
void enableSecondOrderCrossDerivatives (bool yn)
 
bool enableSecondOrderCrossDerivatives () const
 
virtual double d2f (const std::string &variable, const ParameterList &parameters)
 Get the value of the second order derivative of the function according to a given set of parameters. More...
 
virtual double d2f (const std::string &variable1, const std::string &variable2, const ParameterList &parameters)
 Get the value of the cross derivative of the function according to a given set of parameters. More...
 
virtual double df (const std::string &variable, const ParameterList &parameters)
 Get the value of the first derivative of the function according to a given set of parameters. More...
 
virtual bool hasParameter (const std::string &name) const =0
 Tell if there is a parameter with specified name. More...
 
bool hasParameter (const std::string &name) const
 Tell if there is a parameter with specified name. More...
 
virtual const ParameterListgetParameters () const =0
 Get all parameters available. More...
 
const ParameterListgetParameters () const
 Get all parameters available. More...
 
virtual const ParametergetParameter (const std::string &name) const =0
 Get the parameter with specified name. More...
 
const ParametergetParameter (const std::string &name) const
 Get the parameter with specified name. More...
 
virtual double getParameterValue (const std::string &name) const =0
 Get the value for parameter of name 'name'. More...
 
double getParameterValue (const std::string &name) const
 Get the value for parameter of name 'name'. More...
 
virtual size_t getNumberOfParameters () const =0
 Get the number of parameters. More...
 
size_t getNumberOfParameters () const
 Get the number of parameters. More...
 
virtual void setNamespace (const std::string &prefix)=0
 Set the namespace for the parameter names. More...
 
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names. More...
 
virtual std::string getNamespace () const =0
 
std::string getNamespace () const
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0
 Resolves a parameter name according to the current namespace. More...
 
std::string getParameterNameWithoutNamespace (const std::string &name) const
 Resolves a parameter name according to the current namespace. More...
 
The DerivableFirstOrder interface
void enableFirstOrderDerivatives (bool yn)
 Tell if derivatives must be computed. More...
 
bool enableFirstOrderDerivatives () const
 Tell if derivatives must be computed. More...
 
double getFirstOrderDerivative (const std::string &variable) const
 Get the derivative of the function at the current point. More...
 
The DerivableSecondOrder interface
void enableSecondOrderDerivatives (bool yn)
 Tell if derivatives must be computed. More...
 
bool enableSecondOrderDerivatives () const
 Tell if derivatives must be computed. More...
 
double getSecondOrderDerivative (const std::string &variable) const
 Get the second order derivative of the function at the current point. More...
 
The Parametrizable interface.
double f (const ParameterList &parameters)
 Get the value of the function according to a given set of parameters. More...
 
void setParameters (const ParameterList &parameters)
 Set the point where the function must be computed. More...
 
void setAllParametersValues (const ParameterList &parameters)
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value)
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters)
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters)
 Update the parameters from parameters. More...
 

Protected Member Functions

void updateDerivatives (const ParameterList parameters)
 Compute derivatives. More...
 
virtual ParameterListgetParameters_ ()=0
 Get all parameters available. More...
 
ParameterListgetParameters_ ()
 Get all parameters available. More...
 

Protected Attributes

DerivableFirstOrderfunction1_
 
DerivableSecondOrderfunction2_
 
double h_
 
std::vector< std::string > variables_
 
std::map< std::string, size_t > index_
 
std::vector< double > der1_
 
std::vector< double > der2_
 
RowMatrix< double > crossDer2_
 
bool computeD1_
 
bool computeD2_
 
bool computeCrossD2_
 
Functionfunction_
 

Private Attributes

double f1_
 
double f2_
 
double f3_
 
double f4_
 
double f5_
 

Detailed Description

Five points numerical derivative function wrapper.

Numerical derivatives use three points to compute the derivatives. $x_0$ is the focus point, $x_{-2} = x_0-2h$, $x_{-1} = x_0-h$, $x_{+1}=x_0+h$ and $x_{+2} = x_0+2h$ are other points, with function values $f_0$, $f_{-2}$, $f_{-1}$, $f_{+1}$ and $f_{+2}$ respectively. The derivatives are then computed using the central formulas:

\begin{eqnarray*} \dfrac{\partial f}{\partial x } &=& \dfrac{f_{-2}-8f_{-1}+8f_{+1}-f_{+2}}{12h}\\ \dfrac{\partial^2 f}{\partial x^2} &=& \dfrac{-f_{-2}+16f_{-1}-30f_0+16f_{+1}-f_{+2}}{12h^2}\\ \end{eqnarray*}

In case of border limit (when $x_{-2}$ or $x_{+2}$ are not computable), the foreward and backward three points computations are performed, respectively:

\begin{eqnarray*} \dfrac{\partial f}{\partial x } &=& \dfrac{f_{+1}-f_0}{h}\\ \dfrac{\partial^2 f}{\partial x^2} &=& \dfrac{f_{+2}-2f_{+1}+f_0}{h^2}\\ \end{eqnarray*}

and

\begin{eqnarray*} \dfrac{\partial f}{\partial x } &=& \dfrac{f_0-f_{-1}}{h}\\ \dfrac{\partial^2 f}{\partial x^2} &=& \dfrac{f_0-2f_{-1}+f_{-2}}{h^2}\\ \end{eqnarray*}

The $h$ parameter is computed in a parameter dependent manner: $ h = x \times e$, with $x \neq 0$ being the current parameter value. If $x = 0$, $h = e$. Default value is provided for $e$ and corresponds to the _h field. The default value works fine in most cases, but you may want to change it using the setInterval method.

Warning
cross second order derivatives are not implemented with the five points method.
See also
AbstractNumericalDerivative

Definition at line 87 of file FivePointsNumericalDerivative.h.

Constructor & Destructor Documentation

◆ FivePointsNumericalDerivative() [1/3]

bpp::FivePointsNumericalDerivative::FivePointsNumericalDerivative ( Function function)
inline

Definition at line 94 of file FivePointsNumericalDerivative.h.

Referenced by clone().

◆ FivePointsNumericalDerivative() [2/3]

bpp::FivePointsNumericalDerivative::FivePointsNumericalDerivative ( DerivableFirstOrder function)
inline

Definition at line 101 of file FivePointsNumericalDerivative.h.

◆ FivePointsNumericalDerivative() [3/3]

bpp::FivePointsNumericalDerivative::FivePointsNumericalDerivative ( DerivableSecondOrder function)
inline

Definition at line 108 of file FivePointsNumericalDerivative.h.

◆ ~FivePointsNumericalDerivative()

virtual bpp::FivePointsNumericalDerivative::~FivePointsNumericalDerivative ( )
inlinevirtual

Definition at line 115 of file FivePointsNumericalDerivative.h.

Member Function Documentation

◆ clone()

FivePointsNumericalDerivative* bpp::FivePointsNumericalDerivative::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::AbstractNumericalDerivative.

Definition at line 117 of file FivePointsNumericalDerivative.h.

References FivePointsNumericalDerivative().

◆ d2f() [1/2]

virtual double bpp::DerivableSecondOrder::d2f ( const std::string &  variable,
const ParameterList parameters 
)
inlinevirtualinherited

Get the value of the second order derivative of the function according to a given set of parameters.

Parameters
variableThe name of the $ x $ variable in $ \frac{\partial^2 f}{\partial x^2} $.
parametersThe parameter set to pass to the function.
Returns
The value of the function with the given parameter set.
Exceptions
ExceptionIf an error occured.

Definition at line 228 of file Functions.h.

References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::setParameters().

◆ d2f() [2/2]

virtual double bpp::DerivableSecondOrder::d2f ( const std::string &  variable1,
const std::string &  variable2,
const ParameterList parameters 
)
inlinevirtualinherited

Get the value of the cross derivative of the function according to a given set of parameters.

Parameters
variable1The name of the $ x $ variable in $ \frac{\partial^2 f}{\partial x \partial y} $.
variable2The name of the $ y $ variable in $ \frac{\partial^2 f}{\partial x \partial y} $.
parametersThe parameter set to pass to the function.
Returns
The value of the function with the given parameter set.
Exceptions
ExceptionIf an error occured.

Definition at line 255 of file Functions.h.

References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::setParameters().

◆ df()

virtual double bpp::DerivableFirstOrder::df ( const std::string &  variable,
const ParameterList parameters 
)
inlinevirtualinherited

Get the value of the first derivative of the function according to a given set of parameters.

Parameters
variableThe name of the $ x $ variable in $ \frac{df}{dx} $.
parametersThe parameter set to pass to the function.
Returns
The value of the function with the given parameter set.
Exceptions
ExceptionIf an error occured.

Definition at line 173 of file Functions.h.

References bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::Function::setParameters().

◆ enableFirstOrderDerivatives() [1/2]

bool bpp::AbstractNumericalDerivative::enableFirstOrderDerivatives ( ) const
inlinevirtualinherited

Tell if derivatives must be computed.

Returns
yes/no

Implements bpp::DerivableFirstOrder.

Definition at line 163 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD1_.

◆ enableFirstOrderDerivatives() [2/2]

void bpp::AbstractNumericalDerivative::enableFirstOrderDerivatives ( bool  yn)
inlinevirtualinherited

Tell if derivatives must be computed.

Parameters
ynyes/no

Implements bpp::DerivableFirstOrder.

Definition at line 162 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD1_.

◆ enableSecondOrderCrossDerivatives() [1/2]

bool bpp::AbstractNumericalDerivative::enableSecondOrderCrossDerivatives ( ) const
inlineinherited

◆ enableSecondOrderCrossDerivatives() [2/2]

void bpp::AbstractNumericalDerivative::enableSecondOrderCrossDerivatives ( bool  yn)
inlineinherited

◆ enableSecondOrderDerivatives() [1/2]

bool bpp::AbstractNumericalDerivative::enableSecondOrderDerivatives ( ) const
inlinevirtualinherited

Tell if derivatives must be computed.

Returns
yes/no

Implements bpp::DerivableSecondOrder.

Definition at line 184 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD2_.

◆ enableSecondOrderDerivatives() [2/2]

void bpp::AbstractNumericalDerivative::enableSecondOrderDerivatives ( bool  yn)
inlinevirtualinherited

Tell if derivatives must be computed.

Parameters
ynyes/no

Implements bpp::DerivableSecondOrder.

Definition at line 183 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD2_.

◆ f()

double bpp::AbstractNumericalDerivative::f ( const ParameterList parameters)
inlinevirtualinherited

Get the value of the function according to a given set of parameters.

Parameters
parametersThe parameter set to pass to the function.
Returns
The value of the function with the given parameter set.
Exceptions
ExceptionIf an error occured.

Reimplemented from bpp::Function.

Definition at line 217 of file AbstractNumericalDerivative.h.

References bpp::FunctionWrapper::getValue(), and bpp::AbstractNumericalDerivative::setParameters().

◆ getFirstOrderDerivative()

double bpp::AbstractNumericalDerivative::getFirstOrderDerivative ( const std::string &  variable) const
inlinevirtualinherited

Get the derivative of the function at the current point.

Parameters
variableThe name of the $ x $ variable in $ \frac{df}{dx} $.
Returns
The value of the function.
Exceptions
ExceptionIf no point is specified or if an error occured.

Implements bpp::DerivableFirstOrder.

Definition at line 165 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD1_, bpp::AbstractNumericalDerivative::der1_, bpp::AbstractNumericalDerivative::function1_, bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::AbstractNumericalDerivative::index_.

◆ getInterval()

double bpp::AbstractNumericalDerivative::getInterval ( ) const
inlineinherited
Returns
The interval value used in numerical approximation.

Definition at line 137 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::h_.

◆ getNamespace() [1/2]

std::string bpp::FunctionWrapper::getNamespace ( ) const
inlinevirtualinherited
Returns
The current namespace used. This is an empty string if no namespace is currently defined.

Implements bpp::Parametrizable.

Definition at line 347 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNamespace().

◆ getNamespace() [2/2]

virtual std::string bpp::Parametrizable::getNamespace ( ) const
pure virtualinherited
Returns
The current namespace used. This is an empty string if no namespace is currently defined.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getNamespace().

◆ getNumberOfParameters() [1/2]

size_t bpp::FunctionWrapper::getNumberOfParameters ( ) const
inlinevirtualinherited

Get the number of parameters.

See also
getNumberOfIndependentParameters If some parameters are aliased.
Returns
The number of parameters.

Implements bpp::Parametrizable.

Definition at line 337 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNumberOfParameters().

◆ getNumberOfParameters() [2/2]

virtual size_t bpp::Parametrizable::getNumberOfParameters ( ) const
pure virtualinherited

Get the number of parameters.

See also
getNumberOfIndependentParameters If some parameters are aliased.
Returns
The number of parameters.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getNumberOfParameters(), and bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution().

◆ getParameter() [1/2]

const Parameter& bpp::FunctionWrapper::getParameter ( const std::string &  name) const
inlinevirtualinherited

Get the parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
The parameter with given name.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 297 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameter().

◆ getParameter() [2/2]

virtual const Parameter& bpp::Parametrizable::getParameter ( const std::string &  name) const
pure virtualinherited

Get the parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
The parameter with given name.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameter().

◆ getParameterNameWithoutNamespace() [1/2]

std::string bpp::FunctionWrapper::getParameterNameWithoutNamespace ( const std::string &  name) const
inlinevirtualinherited

Resolves a parameter name according to the current namespace.

Returns
The parameter name without the namespace prefix, if any.

Implements bpp::Parametrizable.

Definition at line 352 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterNameWithoutNamespace().

◆ getParameterNameWithoutNamespace() [2/2]

virtual std::string bpp::Parametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const
pure virtualinherited

Resolves a parameter name according to the current namespace.

Returns
The parameter name without the namespace prefix, if any.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameterNameWithoutNamespace(), and bpp::BppOParametrizableFormat::write().

◆ getParameters() [1/2]

const ParameterList& bpp::FunctionWrapper::getParameters ( ) const
inlinevirtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 292 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameters().

◆ getParameters() [2/2]

virtual const ParameterList& bpp::Parametrizable::getParameters ( ) const
pure virtualinherited

◆ getParameters_() [1/2]

ParameterList& bpp::FunctionWrapper::getParameters_ ( )
inlineprotectedvirtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 358 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameters_().

◆ getParameters_() [2/2]

virtual ParameterList& bpp::Parametrizable::getParameters_ ( )
protectedpure virtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implemented in bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameters_().

◆ getParameterValue() [1/2]

double bpp::FunctionWrapper::getParameterValue ( const std::string &  name) const
inlinevirtualinherited

Get the value for parameter of name 'name'.

Parameters
nameThe name of the parameter.
Returns
the value of parameter name.

Implements bpp::Parametrizable.

Definition at line 312 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterValue().

◆ getParameterValue() [2/2]

virtual double bpp::Parametrizable::getParameterValue ( const std::string &  name) const
pure virtualinherited

Get the value for parameter of name 'name'.

Parameters
nameThe name of the parameter.
Returns
the value of parameter name.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameterValue().

◆ getSecondOrderDerivative() [1/2]

double bpp::AbstractNumericalDerivative::getSecondOrderDerivative ( const std::string &  variable) const
inlinevirtualinherited

Get the second order derivative of the function at the current point.

Parameters
variableThe name of the $ x $ variable in $ \frac{\partial^2 f}{\partial x^2} $.
Returns
The value of the function.
Exceptions
ExceptionIf no point is specified or if an error occured.

Implements bpp::DerivableSecondOrder.

Reimplemented in bpp::TwoPointsNumericalDerivative.

Definition at line 186 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::computeD2_, bpp::AbstractNumericalDerivative::der2_, bpp::AbstractNumericalDerivative::function2_, bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::AbstractNumericalDerivative::index_.

◆ getSecondOrderDerivative() [2/2]

double bpp::FivePointsNumericalDerivative::getSecondOrderDerivative ( const std::string &  variable1,
const std::string &  variable2 
) const
inlinevirtual

Get the value of the cross derivative of the function according to a given set of parameters.

Parameters
variable1The name of the $ x $ variable in $ \frac{\partial^2 f}{\partial x \partial y} $.
variable2The name of the $ y $ variable in $ \frac{\partial^2 f}{\partial x \partial y} $.
Returns
The value of the function with the given parameter set.
Exceptions
ExceptionIf an error occured.

Reimplemented from bpp::AbstractNumericalDerivative.

Definition at line 125 of file FivePointsNumericalDerivative.h.

◆ getValue()

double bpp::FivePointsNumericalDerivative::getValue ( ) const
inlinevirtual

Get the value of the function at the current point.

Returns
The value of the function.
Exceptions
ExceptionIf no point is specified or if an error occured.

Implements bpp::Function.

Definition at line 120 of file FivePointsNumericalDerivative.h.

References f3_.

◆ hasParameter() [1/2]

bool bpp::FunctionWrapper::hasParameter ( const std::string &  name) const
inlinevirtualinherited

Tell if there is a parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
y/n.

Implements bpp::Parametrizable.

Definition at line 282 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::hasParameter().

◆ hasParameter() [2/2]

virtual bool bpp::Parametrizable::hasParameter ( const std::string &  name) const
pure virtualinherited

Tell if there is a parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
y/n.

Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::hasParameter().

◆ matchParametersValues()

bool bpp::AbstractNumericalDerivative::matchParametersValues ( const ParameterList parameters)
inlinevirtualinherited

Update the parameters from parameters.

Only common parameters with parameters will be updated.

Parameters
parametersA list of parameters.
Returns
True if at least one parameter value has been changed.
Exceptions
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 245 of file AbstractNumericalDerivative.h.

References bpp::FunctionWrapper::function_, bpp::Parametrizable::matchParametersValues(), and bpp::AbstractNumericalDerivative::updateDerivatives().

◆ setAllParametersValues()

void bpp::AbstractNumericalDerivative::setAllParametersValues ( const ParameterList parameters)
inlinevirtualinherited

Set the parameters values to be equals to those of parameters.

The list must contain exactly the same parameters (ie same names) than the parameters available.

Parameters
parametersA list with all parameters.
Exceptions
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 227 of file AbstractNumericalDerivative.h.

References bpp::FunctionWrapper::function_, bpp::Parametrizable::setAllParametersValues(), and bpp::AbstractNumericalDerivative::updateDerivatives().

◆ setInterval()

void bpp::AbstractNumericalDerivative::setInterval ( double  h)
inlineinherited

Set the interval value used in numerical approximation.

Default value is 0.0001.

Parameters
hInterval value.

Definition at line 132 of file AbstractNumericalDerivative.h.

References bpp::AbstractNumericalDerivative::h_.

◆ setNamespace() [1/2]

void bpp::FunctionWrapper::setNamespace ( const std::string &  prefix)
inlinevirtualinherited

Set the namespace for the parameter names.

Parameters
prefixThe 'namespace', that is a prefix to add to all parameter names. If parameter names are already prefixed, the new prefix will be used instead.

Implements bpp::Parametrizable.

Definition at line 342 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setNamespace().

◆ setNamespace() [2/2]

virtual void bpp::Parametrizable::setNamespace ( const std::string &  prefix)
pure virtualinherited

◆ setParameters()

void bpp::AbstractNumericalDerivative::setParameters ( const ParameterList parameters)
inlinevirtualinherited

Set the point where the function must be computed.

Parameters
parametersThe parameter set to pass to the function.

Implements bpp::Function.

Definition at line 222 of file AbstractNumericalDerivative.h.

References bpp::FunctionWrapper::function_, bpp::Function::setParameters(), and bpp::AbstractNumericalDerivative::updateDerivatives().

Referenced by bpp::AbstractNumericalDerivative::f().

◆ setParametersToDerivate()

void bpp::AbstractNumericalDerivative::setParametersToDerivate ( const std::vector< std::string > &  variables)
inlineinherited

◆ setParametersValues()

void bpp::AbstractNumericalDerivative::setParametersValues ( const ParameterList parameters)
inlinevirtualinherited

Update the parameters from parameters.

parameters must be a subset of all parameters available.

Parameters
parametersA list containing all parameters to update.
Exceptions
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 239 of file AbstractNumericalDerivative.h.

References bpp::FunctionWrapper::function_, bpp::Parametrizable::setParametersValues(), and bpp::AbstractNumericalDerivative::updateDerivatives().

◆ setParameterValue()

void bpp::AbstractNumericalDerivative::setParameterValue ( const std::string &  name,
double  value 
)
inlinevirtualinherited

Set the value of parameter with name name to be equal to value.

Parameters
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf value does not match the constraint associated to parameter name.

Implements bpp::Parametrizable.

Definition at line 233 of file AbstractNumericalDerivative.h.

References bpp::ParameterList::createSubList(), bpp::FunctionWrapper::function_, bpp::Parametrizable::getParameters(), bpp::Parametrizable::setParameterValue(), and bpp::AbstractNumericalDerivative::updateDerivatives().

◆ updateDerivatives()

void FivePointsNumericalDerivative::updateDerivatives ( const ParameterList  parameters)
protectedvirtual

Compute derivatives.

Parameters
parametersThe point where to compute derivatives. It is NOT passed as references, as the inner parameters of the function will be changed when computing the numerical derivatives.

Implements bpp::AbstractNumericalDerivative.

Definition at line 47 of file FivePointsNumericalDerivative.cpp.

References bpp::ParameterList::createSubList(), bpp::ParameterList::getParameterValue(), bpp::ParameterList::hasParameter(), and bpp::ParameterList::setParameters().

Member Data Documentation

◆ computeCrossD2_

◆ computeD1_

◆ computeD2_

◆ crossDer2_

◆ der1_

std::vector<double> bpp::AbstractNumericalDerivative::der1_
protectedinherited

◆ der2_

std::vector<double> bpp::AbstractNumericalDerivative::der2_
protectedinherited

◆ f1_

double bpp::FivePointsNumericalDerivative::f1_
private

Definition at line 91 of file FivePointsNumericalDerivative.h.

◆ f2_

double bpp::FivePointsNumericalDerivative::f2_
private

Definition at line 91 of file FivePointsNumericalDerivative.h.

◆ f3_

double bpp::FivePointsNumericalDerivative::f3_
private

Definition at line 91 of file FivePointsNumericalDerivative.h.

Referenced by getValue().

◆ f4_

double bpp::FivePointsNumericalDerivative::f4_
private

Definition at line 91 of file FivePointsNumericalDerivative.h.

◆ f5_

double bpp::FivePointsNumericalDerivative::f5_
private

Definition at line 91 of file FivePointsNumericalDerivative.h.

◆ function1_

DerivableFirstOrder* bpp::AbstractNumericalDerivative::function1_
protectedinherited

◆ function2_

DerivableSecondOrder* bpp::AbstractNumericalDerivative::function2_
protectedinherited

◆ function_

Function* bpp::FunctionWrapper::function_
protectedinherited

Definition at line 270 of file Functions.h.

Referenced by bpp::DerivableFirstOrderWrapper::enableFirstOrderDerivatives(), bpp::DerivableSecondOrderWrapper::enableSecondOrderDerivatives(), bpp::FunctionWrapper::f(), bpp::DerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::InfinityDerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::FunctionWrapper::getNamespace(), bpp::FunctionWrapper::getNumberOfParameters(), bpp::FunctionWrapper::getParameter(), bpp::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::FunctionWrapper::getParameters(), bpp::FunctionWrapper::getParameters_(), bpp::FunctionWrapper::getParameterValue(), bpp::DerivableSecondOrderWrapper::getSecondOrderDerivative(), bpp::InfinityDerivableSecondOrderWrapper::getSecondOrderDerivative(), bpp::FunctionWrapper::getValue(), bpp::InfinityFunctionWrapper::getValue(), bpp::FunctionWrapper::hasParameter(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), bpp::InfinityFunctionWrapper::matchParametersValues(), bpp::FunctionWrapper::operator=(), bpp::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), bpp::InfinityFunctionWrapper::setAllParametersValues(), bpp::FunctionWrapper::setNamespace(), bpp::AbstractNumericalDerivative::setParameters(), bpp::FunctionWrapper::setParameters(), bpp::InfinityFunctionWrapper::setParameters(), bpp::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), bpp::InfinityFunctionWrapper::setParametersValues(), bpp::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().

◆ h_

double bpp::AbstractNumericalDerivative::h_
protectedinherited

◆ index_

◆ variables_

std::vector<std::string> bpp::AbstractNumericalDerivative::variables_
protectedinherited

The documentation for this class was generated from the following files: