bpp-core3  3.0.0
bpp::TwoPointsNumericalDerivative Class Referenceabstract

Two points numerical derivative function wrapper. More...

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

+ Inheritance diagram for bpp::TwoPointsNumericalDerivative:
+ Collaboration diagram for bpp::TwoPointsNumericalDerivative:

Public Member Functions

 TwoPointsNumericalDerivative (std::shared_ptr< FunctionInterface > function)
 
 TwoPointsNumericalDerivative (std::shared_ptr< FirstOrderDerivable > function)
 
virtual ~TwoPointsNumericalDerivative ()
 
TwoPointsNumericalDerivativeclone () const override
 Create a copy of this object and send a pointer to it. More...
 
double getValue () const override
 Get the value of the function at the current point. More...
 
void setInterval (double h) override
 Set the interval value used in numerical approximation. More...
 
double getInterval () const override
 
void setParametersToDerivate (const std::vector< std::string > &variables) override
 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 override
 Tell if there is a parameter with specified name. More...
 
virtual const ParameterListgetParameters () const =0
 Get all parameters available. More...
 
const ParameterListgetParameters () const override
 Get all parameters available. More...
 
virtual const Parameterparameter (const std::string &name) const =0
 Get the parameter with specified name. More...
 
const Parameterparameter (const std::string &name) const override
 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 override
 Get the value for parameter of name 'name'. More...
 
virtual void removeConstraint (const std::string &name)=0
 Remove the constraint associated with one parameter, if any. More...
 
void removeConstraint (const std::string &name) override
 Remove the constraint associated with one parameter, if any. More...
 
virtual void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0
 Set/Change the constraint associated with one parameter. More...
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 Set/Change the constraint associated with one parameter. More...
 
virtual size_t getNumberOfParameters () const =0
 Get the number of parameters. More...
 
size_t getNumberOfParameters () const override
 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) override
 Set the namespace for the parameter names. More...
 
virtual std::string getNamespace () const =0
 
std::string getNamespace () const override
 
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 override
 Resolves a parameter name according to the current namespace. More...
 
The DerivableSecondOrder interface
double getSecondOrderDerivative (const std::string &variable) const override
 Get the second order derivative of the function at the current point. More...
 
double getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const override
 Get the value of the cross derivative of the function according to a given set of parameters. More...
 
The DerivableFirstOrder interface
void enableFirstOrderDerivatives (bool yn) override
 Tell if derivatives must be computed. More...
 
bool enableFirstOrderDerivatives () const override
 Tell if derivatives must be computed. More...
 
double getFirstOrderDerivative (const std::string &variable) const override
 Get the derivative of the function at the current point. More...
 
The DerivableSecondOrder interface
void enableSecondOrderDerivatives (bool yn) override
 Tell if derivatives must be computed. More...
 
bool enableSecondOrderDerivatives () const override
 Tell if derivatives must be computed. More...
 
The Parametrizable interface.
double f (const ParameterList &parameters) override
 Get the value of the function according to a given set of parameters. More...
 
void setParameters (const ParameterList &parameters) override
 Set the point where the function must be computed. More...
 
void setAllParametersValues (const ParameterList &parameters) override
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value) override
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 

Protected Member Functions

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

Protected Attributes

std::shared_ptr< FirstOrderDerivablefunction1_
 
std::shared_ptr< SecondOrderDerivablefunction2_
 
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_
 
std::shared_ptr< FunctionInterfacefunction_
 

Private Attributes

double f1_
 
double f2_
 

Detailed Description

Two points numerical derivative function wrapper.

Numerical derivatives use two points to compute the (first order) derivatives. $x_0$ is the focus point and $x_{+1} = x_0+h$ (or $x_0-h$, if constrained on the right). Corresponding function values are $f_0$, $f_{-1}$ and $f_{+1/-1}$ respectively. The derivatives are then computed using the central formulas:

\begin{eqnarray*} \dfrac{\partial f}{\partial x } &=& \dfrac{f_{+1}-f_{0}}{h}\mathrm{\ or}\\ \dfrac{\partial f}{\partial x } &=& \dfrac{f_{0}-f_{-1}}{h}\\ \end{eqnarray*}

This class does not allow computation of second order derivatives.

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.

See also
AbstractNumericalDerivative, ThreePointsNumericalDerivative, FivePointsNumericalDerivative

Definition at line 40 of file TwoPointsNumericalDerivative.h.

Constructor & Destructor Documentation

◆ TwoPointsNumericalDerivative() [1/2]

bpp::TwoPointsNumericalDerivative::TwoPointsNumericalDerivative ( std::shared_ptr< FunctionInterface function)
inline

Definition at line 47 of file TwoPointsNumericalDerivative.h.

Referenced by clone().

◆ TwoPointsNumericalDerivative() [2/2]

bpp::TwoPointsNumericalDerivative::TwoPointsNumericalDerivative ( std::shared_ptr< FirstOrderDerivable function)
inline

Definition at line 51 of file TwoPointsNumericalDerivative.h.

◆ ~TwoPointsNumericalDerivative()

virtual bpp::TwoPointsNumericalDerivative::~TwoPointsNumericalDerivative ( )
inlinevirtual

Definition at line 55 of file TwoPointsNumericalDerivative.h.

Member Function Documentation

◆ clone()

TwoPointsNumericalDerivative* bpp::TwoPointsNumericalDerivative::clone ( ) const
inlineoverridevirtual

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 57 of file TwoPointsNumericalDerivative.h.

References TwoPointsNumericalDerivative().

◆ d2f() [1/2]

virtual double bpp::SecondOrderDerivable::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 193 of file Functions.h.

References bpp::FunctionInterface::setParameters().

◆ d2f() [2/2]

virtual double bpp::SecondOrderDerivable::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 220 of file Functions.h.

References bpp::FunctionInterface::setParameters().

◆ df()

virtual double bpp::FirstOrderDerivable::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 138 of file Functions.h.

References bpp::FunctionInterface::setParameters().

◆ enableFirstOrderDerivatives() [1/2]

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

Tell if derivatives must be computed.

Parameters
ynyes/no

Implements bpp::FirstOrderDerivable.

Definition at line 144 of file NumericalDerivative.h.

◆ enableFirstOrderDerivatives() [2/2]

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

Tell if derivatives must be computed.

Returns
yes/no

Implements bpp::FirstOrderDerivable.

Definition at line 145 of file NumericalDerivative.h.

◆ enableSecondOrderCrossDerivatives() [1/2]

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

Definition at line 235 of file NumericalDerivative.h.

◆ enableSecondOrderCrossDerivatives() [2/2]

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

Definition at line 236 of file NumericalDerivative.h.

◆ enableSecondOrderDerivatives() [1/2]

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

Tell if derivatives must be computed.

Parameters
ynyes/no

Implements bpp::SecondOrderDerivable.

Definition at line 165 of file NumericalDerivative.h.

◆ enableSecondOrderDerivatives() [2/2]

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

Tell if derivatives must be computed.

Returns
yes/no

Implements bpp::SecondOrderDerivable.

Definition at line 166 of file NumericalDerivative.h.

◆ f()

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

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::FunctionWrapper.

Definition at line 199 of file NumericalDerivative.h.

References bpp::FunctionInterface::getValue(), and bpp::FunctionInterface::setParameters().

◆ getFirstOrderDerivative()

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

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::FirstOrderDerivable.

Definition at line 147 of file NumericalDerivative.h.

◆ getInterval()

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

Implements bpp::NumericalDerivativeInterface.

Definition at line 124 of file NumericalDerivative.h.

◆ getNamespace() [1/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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::Parametrizable::~Parametrizable().

◆ getNamespace() [2/2]

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

Implements bpp::Parametrizable.

Definition at line 322 of file Functions.h.

◆ getNumberOfParameters() [1/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::FunctionWrapper, bpp::ParametrizableAdapter, bpp::AbstractParametrizable, and bpp::DirectionFunction.

Referenced by bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution(), and bpp::Parametrizable::~Parametrizable().

◆ getNumberOfParameters() [2/2]

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

Get the number of parameters.

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

Implements bpp::Parametrizable.

Definition at line 312 of file Functions.h.

◆ getParameterNameWithoutNamespace() [1/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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::BppODiscreteDistributionFormat::readDiscreteDistribution(), bpp::BppOParametrizableFormat::write(), and bpp::Parametrizable::~Parametrizable().

◆ getParameterNameWithoutNamespace() [2/2]

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

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 327 of file Functions.h.

◆ getParameters() [1/2]

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

◆ getParameters() [2/2]

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

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 257 of file Functions.h.

◆ getParameters_() [1/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::AbstractParametrizable, and bpp::DirectionFunction.

Referenced by bpp::Parametrizable::~Parametrizable().

◆ getParameters_() [2/2]

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

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 333 of file Functions.h.

◆ getParameterValue() [1/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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::BppODiscreteDistributionFormat::readDiscreteDistribution(), and bpp::Parametrizable::~Parametrizable().

◆ getParameterValue() [2/2]

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

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 277 of file Functions.h.

◆ getSecondOrderDerivative() [1/2]

double bpp::TwoPointsNumericalDerivative::getSecondOrderDerivative ( const std::string &  variable) const
inlineoverridevirtual

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.

Reimplemented from bpp::AbstractNumericalDerivative.

Definition at line 70 of file TwoPointsNumericalDerivative.h.

◆ getSecondOrderDerivative() [2/2]

double bpp::TwoPointsNumericalDerivative::getSecondOrderDerivative ( const std::string &  variable1,
const std::string &  variable2 
) const
inlineoverridevirtual

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 75 of file TwoPointsNumericalDerivative.h.

References updateDerivatives().

◆ getValue()

double bpp::TwoPointsNumericalDerivative::getValue ( ) const
inlineoverridevirtual

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.

Reimplemented from bpp::FunctionWrapper.

Definition at line 63 of file TwoPointsNumericalDerivative.h.

References f1_.

◆ hasParameter() [1/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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::Parametrizable::~Parametrizable().

◆ hasParameter() [2/2]

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

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 247 of file Functions.h.

◆ matchParametersValues()

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

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.

Reimplemented from bpp::FunctionWrapper.

Definition at line 227 of file NumericalDerivative.h.

◆ parameter() [1/2]

virtual const Parameter& bpp::Parametrizable::parameter ( 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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::TestFunction::getValue(), and bpp::Parametrizable::~Parametrizable().

◆ parameter() [2/2]

const Parameter& bpp::FunctionWrapper::parameter ( const std::string &  name) const
inlineoverridevirtualinherited

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 262 of file Functions.h.

◆ removeConstraint() [1/2]

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

Remove the constraint associated with one parameter, if any.

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

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

Referenced by bpp::Parametrizable::~Parametrizable().

◆ removeConstraint() [2/2]

void bpp::FunctionWrapper::removeConstraint ( const std::string &  name)
inlineoverridevirtualinherited

Remove the constraint associated with one parameter, if any.

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

Implements bpp::Parametrizable.

Definition at line 302 of file Functions.h.

◆ setAllParametersValues()

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

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.

Reimplemented from bpp::FunctionWrapper.

Definition at line 209 of file NumericalDerivative.h.

◆ setConstraint() [1/2]

virtual void bpp::Parametrizable::setConstraint ( const std::string &  name,
std::shared_ptr< ConstraintInterface constraint 
)
pure virtualinherited

Set/Change the constraint associated with one parameter.

Parameters
nameThe name of the parameter to look for.
constraintA pointer to the constraint (may be null)
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

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

Referenced by bpp::Parametrizable::~Parametrizable().

◆ setConstraint() [2/2]

void bpp::FunctionWrapper::setConstraint ( const std::string &  name,
std::shared_ptr< ConstraintInterface constraint 
)
inlineoverridevirtualinherited

Set/Change the constraint associated with one parameter.

Parameters
nameThe name of the parameter to look for.
constraintA pointer to the constraint (may be null)
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 307 of file Functions.h.

◆ setInterval()

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

Set the interval value used in numerical approximation.

Default value is 0.0001.

Parameters
hInterval value.

Implements bpp::NumericalDerivativeInterface.

Definition at line 122 of file NumericalDerivative.h.

◆ setNamespace() [1/2]

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

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.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::AbstractParameterAliasable, bpp::MixtureOfDiscreteDistributions, bpp::AbstractParametrizable, and bpp::InvariantMixedDiscreteDistribution.

Referenced by bpp::Parametrizable::~Parametrizable().

◆ setNamespace() [2/2]

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

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 317 of file Functions.h.

◆ setParameters()

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

Set the point where the function must be computed.

Parameters
parametersThe parameter set to pass to the function.

Reimplemented from bpp::FunctionWrapper.

Definition at line 204 of file NumericalDerivative.h.

◆ setParametersToDerivate()

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

Set the list of parameters to derivate numerically.

Parameters
variablesA list of all parameter names.

Implements bpp::NumericalDerivativeInterface.

Definition at line 126 of file NumericalDerivative.h.

References bpp::RowMatrix< Scalar >::resize().

◆ setParametersValues()

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

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.

Reimplemented from bpp::FunctionWrapper.

Definition at line 221 of file NumericalDerivative.h.

◆ setParameterValue()

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

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.

Reimplemented from bpp::FunctionWrapper.

Definition at line 215 of file NumericalDerivative.h.

◆ updateDerivatives()

void TwoPointsNumericalDerivative::updateDerivatives ( const ParameterList parameters)
overrideprotectedvirtual

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 10 of file TwoPointsNumericalDerivative.cpp.

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

Referenced by getSecondOrderDerivative().

Member Data Documentation

◆ computeCrossD2_

bool bpp::AbstractNumericalDerivative::computeCrossD2_
protectedinherited

Definition at line 77 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ computeD1_

bool bpp::AbstractNumericalDerivative::computeD1_
protectedinherited

Definition at line 77 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ computeD2_

bool bpp::AbstractNumericalDerivative::computeD2_
protectedinherited

Definition at line 77 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ crossDer2_

RowMatrix<double> bpp::AbstractNumericalDerivative::crossDer2_
protectedinherited

Definition at line 76 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ der1_

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

Definition at line 74 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ der2_

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

Definition at line 75 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ f1_

double bpp::TwoPointsNumericalDerivative::f1_
private

Definition at line 44 of file TwoPointsNumericalDerivative.h.

Referenced by getValue().

◆ f2_

double bpp::TwoPointsNumericalDerivative::f2_
private

Definition at line 44 of file TwoPointsNumericalDerivative.h.

◆ function1_

std::shared_ptr<FirstOrderDerivable> bpp::AbstractNumericalDerivative::function1_
protectedinherited

Definition at line 69 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ function2_

std::shared_ptr<SecondOrderDerivable> bpp::AbstractNumericalDerivative::function2_
protectedinherited

Definition at line 70 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ function_

std::shared_ptr<FunctionInterface> bpp::FunctionWrapper::function_
protectedinherited

Definition at line 235 of file Functions.h.

Referenced by bpp::FunctionWrapper::operator=().

◆ h_

double bpp::AbstractNumericalDerivative::h_
protectedinherited

Definition at line 71 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ index_

std::map<std::string, size_t> bpp::AbstractNumericalDerivative::index_
mutableprotectedinherited

Definition at line 73 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().

◆ variables_

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

Definition at line 72 of file NumericalDerivative.h.

Referenced by bpp::AbstractNumericalDerivative::operator=().


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