bpp-core3  3.0.0
bpp::ReparametrizationDerivableFirstOrderWrapper Class Referenceabstract

Function wrapper that remove simple constraints on parameters. Also transform first order derivatives. More...

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

+ Inheritance diagram for bpp::ReparametrizationDerivableFirstOrderWrapper:
+ Collaboration diagram for bpp::ReparametrizationDerivableFirstOrderWrapper:

Public Member Functions

 ReparametrizationDerivableFirstOrderWrapper (std::shared_ptr< FirstOrderDerivable > function, bool verbose=true)
 Build a new reparametrization wrapper for the given function, using all available parameters. More...
 
 ReparametrizationDerivableFirstOrderWrapper (std::shared_ptr< FirstOrderDerivable > function, const ParameterList &parameters, bool verbose=true)
 Build a new reparametrization wrapper for the given function, using only the specified parameters. More...
 
virtual ~ReparametrizationDerivableFirstOrderWrapper ()
 
ReparametrizationDerivableFirstOrderWrapperclone () const
 Create a copy of this object and send a pointer to it. More...
 
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...
 
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 void setParameters (const ParameterList &parameters)=0
 Set the point where the function must be computed. More...
 
virtual double getValue () const =0
 Get the value of the function at the current point. More...
 
virtual double f (const ParameterList &parameters)
 Get the value 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...
 
virtual const ParameterListgetParameters () const =0
 Get all parameters available. More...
 
virtual const Parameterparameter (const std::string &name) const =0
 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...
 
virtual void setAllParametersValues (const ParameterList &parameters)=0
 Set the parameters values to be equals to those of parameters. More...
 
virtual void setParameterValue (const std::string &name, double value)=0
 Set the value of parameter with name name to be equal to value. More...
 
virtual void setParametersValues (const ParameterList &parameters)=0
 Update the parameters from parameters. More...
 
virtual bool matchParametersValues (const ParameterList &parameters)=0
 Update the parameters from parameters. More...
 
virtual void removeConstraint (const std::string &name)=0
 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...
 
virtual size_t getNumberOfParameters () const =0
 Get the number of parameters. More...
 
virtual void setNamespace (const std::string &prefix)=0
 Set the namespace for the parameter names. More...
 
virtual std::string getNamespace () const =0
 
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0
 Resolves a parameter name according to the current namespace. More...
 
virtual const FunctionInterfacefunction () const
 
virtual FunctionInterfacefunction ()
 
virtual std::shared_ptr< const FunctionInterfacegetFunction () const
 
virtual std::shared_ptr< FunctionInterfacegetFunction ()
 
void setParameters (const ParameterList &parameters)
 Set the point where the function must be computed. More...
 
double getValue () const
 Get the value of the function at the current point. More...
 
void fireParameterChanged (const ParameterList &parameters)
 Notify the class when one or several parameters have changed. More...
 
bool hasParameter (const std::string &name) const override
 Tell if there is a parameter with specified name. More...
 
const ParameterListgetParameters () const override
 Get all parameters available. More...
 
const Parameterparameter (const std::string &name) const override
 Get the parameter with specified name. More...
 
double getParameterValue (const std::string &name) const override
 Get the value for parameter of name 'name'. 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...
 
void removeConstraint (const std::string &name) override
 Remove the constraint associated with one parameter, if any. More...
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 Set/Change the constraint associated with one parameter. More...
 
size_t getNumberOfParameters () const override
 Get the number of parameters. More...
 
void setNamespace (const std::string &prefix) override
 Set the namespace for the parameter names. More...
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 Resolves a parameter name according to the current namespace. More...
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 

Protected Member Functions

virtual ParameterListgetParameters_ ()=0
 Get all parameters available. More...
 
ParameterListgetParameters_ () override
 Get all parameters available. More...
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
virtual void addParameter_ (Parameter *parameter)
 
virtual void addParameters_ (const ParameterList &parameters)
 
virtual void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
virtual void shareParameters_ (const ParameterList &parameters)
 
virtual void includeParameters_ (const ParameterList &parameters)
 
virtual void deleteParameter_ (size_t index)
 
virtual void deleteParameter_ (std::string &name)
 
virtual void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 

Protected Attributes

std::shared_ptr< FunctionInterfacefunction_
 
ParameterList functionParameters_
 

Private Member Functions

void init_ (bool verbose)
 

Detailed Description

Function wrapper that remove simple constraints on parameters. Also transform first order derivatives.

This function takes as input another function and reparametrize it when possible. currently, only constraint of the type ]a, b[ where a and b can be +/- inf.

Definition at line 113 of file ReparametrizationFunctionWrapper.h.

Constructor & Destructor Documentation

◆ ReparametrizationDerivableFirstOrderWrapper() [1/2]

bpp::ReparametrizationDerivableFirstOrderWrapper::ReparametrizationDerivableFirstOrderWrapper ( std::shared_ptr< FirstOrderDerivable function,
bool  verbose = true 
)
inline

Build a new reparametrization wrapper for the given function, using all available parameters.

Parameters
functionThe function to reparametrize.
verbosePrint some information.

Definition at line 124 of file ReparametrizationFunctionWrapper.h.

◆ ReparametrizationDerivableFirstOrderWrapper() [2/2]

bpp::ReparametrizationDerivableFirstOrderWrapper::ReparametrizationDerivableFirstOrderWrapper ( std::shared_ptr< FirstOrderDerivable function,
const ParameterList parameters,
bool  verbose = true 
)
inline

Build a new reparametrization wrapper for the given function, using only the specified parameters.

Parameters
functionThe function to reparametrize.
parametersThe list of parameters that will be reparametrized. The intersection with the list of function parameters will be used in the reparametrized function. Any other parameters (in the given list or in the original function) will be ignored.
verbosePrint some information.

Definition at line 137 of file ReparametrizationFunctionWrapper.h.

◆ ~ReparametrizationDerivableFirstOrderWrapper()

virtual bpp::ReparametrizationDerivableFirstOrderWrapper::~ReparametrizationDerivableFirstOrderWrapper ( )
inlinevirtual

Definition at line 141 of file ReparametrizationFunctionWrapper.h.

Member Function Documentation

◆ addParameter_()

virtual void bpp::AbstractParametrizable::addParameter_ ( Parameter parameter)
inlineprotectedvirtualinherited

◆ addParameters_()

◆ clone()

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

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

Returns
A pointer toward the copy object.

Implements bpp::FirstOrderDerivable.

Reimplemented in bpp::ReparametrizationDerivableSecondOrderWrapper.

Definition at line 143 of file ReparametrizationFunctionWrapper.h.

References bpp::ReparametrizationFunctionWrapper::init_().

◆ deleteParameter_() [1/2]

virtual void bpp::AbstractParametrizable::deleteParameter_ ( size_t  index)
inlineprotectedvirtualinherited

◆ deleteParameter_() [2/2]

virtual void bpp::AbstractParametrizable::deleteParameter_ ( std::string &  name)
inlineprotectedvirtualinherited

◆ deleteParameters_()

virtual void bpp::AbstractParametrizable::deleteParameters_ ( const std::vector< std::string > &  names)
inlineprotectedvirtualinherited

◆ 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::ReparametrizationDerivableFirstOrderWrapper::enableFirstOrderDerivatives ( bool  yn)
inlinevirtual

Tell if derivatives must be computed.

Parameters
ynyes/no

Implements bpp::FirstOrderDerivable.

Definition at line 149 of file ReparametrizationFunctionWrapper.h.

References enableFirstOrderDerivatives(), and bpp::ReparametrizationFunctionWrapper::function_.

Referenced by enableFirstOrderDerivatives().

◆ enableFirstOrderDerivatives() [2/2]

bool bpp::ReparametrizationDerivableFirstOrderWrapper::enableFirstOrderDerivatives ( ) const
inlinevirtual

Tell if derivatives must be computed.

Returns
yes/no

Implements bpp::FirstOrderDerivable.

Definition at line 151 of file ReparametrizationFunctionWrapper.h.

References enableFirstOrderDerivatives(), and bpp::ReparametrizationFunctionWrapper::function_.

Referenced by enableFirstOrderDerivatives().

◆ f()

virtual double bpp::FunctionInterface::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 in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 82 of file Functions.h.

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

Referenced by bpp::NumTools::uniRoot().

◆ fireParameterChanged()

void ReparametrizationFunctionWrapper::fireParameterChanged ( const ParameterList parameters)
virtualinherited

Notify the class when one or several parameters have changed.

Parameters
parametersA ParameterList object with parameters that changed.

Reimplemented from bpp::AbstractParametrizable.

Definition at line 141 of file ReparametrizationFunctionWrapper.cpp.

References bpp::ApplicationTools::error, and bpp::Parameter::setValue().

Referenced by bpp::ReparametrizationFunctionWrapper::getValue().

◆ function() [1/2]

virtual const FunctionInterface& bpp::ReparametrizationFunctionWrapper::function ( ) const
inlinevirtualinherited

◆ function() [2/2]

virtual FunctionInterface& bpp::ReparametrizationFunctionWrapper::function ( )
inlinevirtualinherited

◆ getFirstOrderDerivative()

double bpp::ReparametrizationDerivableFirstOrderWrapper::getFirstOrderDerivative ( const std::string &  variable) const
inlinevirtual

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 153 of file ReparametrizationFunctionWrapper.h.

References bpp::ReparametrizationFunctionWrapper::function_, and bpp::AbstractParametrizable::parameter().

◆ getFunction() [1/2]

virtual std::shared_ptr<const FunctionInterface> bpp::ReparametrizationFunctionWrapper::getFunction ( ) const
inlinevirtualinherited

◆ getFunction() [2/2]

virtual std::shared_ptr<FunctionInterface> bpp::ReparametrizationFunctionWrapper::getFunction ( )
inlinevirtualinherited

◆ getNamespace() [1/2]

std::string bpp::AbstractParametrizable::getNamespace ( ) const
inlineoverridevirtualinherited

◆ 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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

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

◆ getNumberOfParameters() [1/2]

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

◆ 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::FunctionWrapper, bpp::ParametrizableAdapter, bpp::AbstractParametrizable, and bpp::DirectionFunction.

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

◆ getParameter() [1/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( const std::string &  name) const
inlineinherited

◆ getParameter() [2/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i) const
inlineprotectedinherited
Returns
The shared_ptr parameter at a given position.
Warning
No check is performed on the validity of the index given as input!

Definition at line 211 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter() [3/3]

std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i)
inlineprotectedinherited

Definition at line 216 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter_() [1/3]

◆ getParameter_() [2/3]

Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index)
inlineprotectedinherited

Definition at line 190 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameter_() [3/3]

const Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index) const
inlineprotectedinherited

Definition at line 197 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameterNameWithoutNamespace() [1/2]

std::string AbstractParametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const
overridevirtualinherited

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 28 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParametrizable::getNamespace(), and bpp::AbstractParameterAliasable::operator=().

◆ 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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

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

◆ getParameters() [1/2]

const ParameterList& bpp::AbstractParametrizable::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 41 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::FullHmmTransitionMatrix::FullHmmTransitionMatrix(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), and bpp::ParametrizableCollection< N >::removeObject().

◆ getParameters() [2/2]

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

◆ 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::AbstractParametrizable::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 205 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::aliasParameters(), and bpp::AbstractParameterAliasable::operator=().

◆ getParameterValue() [1/2]

◆ 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::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

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

◆ getParameterWithNamespace_() [1/2]

Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name)
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 176 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_().

◆ getParameterWithNamespace_() [2/2]

const Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) const
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 185 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameter().

◆ getValue() [1/2]

◆ getValue() [2/2]

double bpp::ReparametrizationFunctionWrapper::getValue ( ) const
inlinevirtualinherited

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

Definition at line 99 of file ReparametrizationFunctionWrapper.h.

References bpp::ReparametrizationFunctionWrapper::fireParameterChanged().

◆ 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::AbstractParametrizable::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 39 of file AbstractParametrizable.h.

References bpp::ParameterList::hasParameter().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AbstractParametrizable::getParameter_(), and bpp::AbstractParameterAliasable::unaliasParameters().

◆ includeParameters_()

virtual void bpp::AbstractParametrizable::includeParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

◆ init_()

void bpp::ReparametrizationDerivableFirstOrderWrapper::init_ ( bool  verbose)
private

◆ matchParametersValues() [1/2]

bool bpp::AbstractParametrizable::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.

Implements bpp::Parametrizable.

Definition at line 76 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::ParameterList::shareSubList().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::Simplex::setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().

◆ matchParametersValues() [2/2]

virtual bool bpp::Parametrizable::matchParametersValues ( const ParameterList parameters)
pure virtualinherited

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.

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

Referenced by bpp::BppODiscreteDistributionFormat::initialize_(), bpp::TestFunction::setParameters(), and bpp::Parametrizable::~Parametrizable().

◆ parameter() [1/2]

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

◆ parameter() [2/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().

◆ removeConstraint() [1/2]

void bpp::AbstractParametrizable::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 85 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::removeConstraint().

◆ removeConstraint() [2/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().

◆ resetParameters_()

void bpp::AbstractParametrizable::resetParameters_ ( )
inlineprotectedinherited

◆ setAllParametersValues() [1/2]

void bpp::AbstractParametrizable::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.

Implements bpp::Parametrizable.

Definition at line 58 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setAllParametersValues().

◆ setAllParametersValues() [2/2]

virtual void bpp::Parametrizable::setAllParametersValues ( const ParameterList parameters)
pure virtualinherited

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.

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

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

◆ setConstraint() [1/2]

void bpp::AbstractParametrizable::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 90 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::setConstraint().

Referenced by bpp::SimpleDiscreteDistribution::restrictToConstraint().

◆ setConstraint() [2/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().

◆ setNamespace() [1/2]

void AbstractParametrizable::setNamespace ( const std::string &  prefix)
overridevirtualinherited

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.

Reimplemented in bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 10 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

Referenced by bpp::AbstractParametrizable::getNumberOfParameters(), bpp::AbstractParameterAliasable::setNamespace(), bpp::LowMemoryRescaledHmmLikelihood::setNamespace(), bpp::LogsumHmmLikelihood::setNamespace(), and bpp::RescaledHmmLikelihood::setNamespace().

◆ setNamespace() [2/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().

◆ setParameters() [1/2]

◆ setParameters() [2/2]

void bpp::ReparametrizationFunctionWrapper::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::FunctionInterface.

Definition at line 90 of file ReparametrizationFunctionWrapper.h.

References bpp::ParameterList::createSubList(), bpp::ParameterList::getParameterNames(), and bpp::AbstractParametrizable::matchParametersValues().

◆ setParametersValues() [1/2]

void bpp::AbstractParametrizable::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.

Implements bpp::Parametrizable.

Definition at line 70 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParametersValues().

Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), bpp::LogsumHmmLikelihood::setParameters(), and bpp::RescaledHmmLikelihood::setParameters().

◆ setParametersValues() [2/2]

virtual void bpp::Parametrizable::setParametersValues ( const ParameterList parameters)
pure virtualinherited

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.

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

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

◆ setParameterValue() [1/2]

void bpp::AbstractParametrizable::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.

Implements bpp::Parametrizable.

Definition at line 64 of file AbstractParametrizable.h.

References bpp::ParameterList::createSubList(), bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParameterValue().

◆ setParameterValue() [2/2]

virtual void bpp::Parametrizable::setParameterValue ( const std::string &  name,
double  value 
)
pure virtualinherited

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.

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

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

◆ shareParameter_()

virtual void bpp::AbstractParametrizable::shareParameter_ ( const std::shared_ptr< Parameter > &  parameter)
inlineprotectedvirtualinherited

◆ shareParameters_()

virtual void bpp::AbstractParametrizable::shareParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

Member Data Documentation

◆ function_

◆ functionParameters_

ParameterList bpp::ReparametrizationFunctionWrapper::functionParameters_
protectedinherited

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