bpp-core3  3.0.0
bpp::DirectionFunction Class Referenceabstract

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

+ Inheritance diagram for bpp::DirectionFunction:
+ Collaboration diagram for bpp::DirectionFunction:

Public Member Functions

 DirectionFunction (Function *function=0)
 
 DirectionFunction (const DirectionFunction &df)
 
DirectionFunctionoperator= (const DirectionFunction &df)
 
virtual ~DirectionFunction ()
 
DirectionFunctionclone () const
 Create a copy of this object and send a pointer to it. More...
 
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...
 
const ParameterListgetParameters () const
 Get all parameters available. More...
 
void init (const ParameterList &p, const std::vector< double > &xi)
 
void autoParameter ()
 
void ignoreConstraints ()
 
void setConstraintPolicy (const std::string &constraintPolicy)
 
std::string getConstraintPolicy () const
 
void setMessageHandler (OutputStream *messenger)
 
FunctiongetFunction () const
 
ParameterList getFunctionParameters () const
 
size_t getNumberOfParameters () const
 Get the number of parameters. 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 ParametergetParameter (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 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...
 
The Parametrizable interface.
bool hasParameter (const std::string &name) const
 Tell if there is a parameter with specified name. More...
 
const ParametergetParameter (const std::string &name) const
 Get the parameter with specified name. More...
 
double getParameterValue (const std::string &name) const
 Get the value for parameter of name 'name'. 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...
 
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names. More...
 
std::string getNamespace () const
 
std::string getParameterNameWithoutNamespace (const std::string &name) const
 Resolves a parameter name according to the current namespace. More...
 

Protected Member Functions

ParameterListgetParameters_ ()
 Get all parameters available. More...
 

Protected Attributes

ParameterList parameters_
 
Parameter parameter_
 

Private Attributes

ParameterList params_
 
ParameterList p_
 
ParameterList xt_
 
std::vector< double > xi_
 
Functionfunction_
 
std::string constraintPolicy_
 
OutputStreammessenger_
 

Detailed Description

Definition at line 53 of file DirectionFunction.h.

Constructor & Destructor Documentation

◆ DirectionFunction() [1/2]

bpp::DirectionFunction::DirectionFunction ( Function function = 0)
inline

Definition at line 65 of file DirectionFunction.h.

Referenced by clone().

◆ DirectionFunction() [2/2]

bpp::DirectionFunction::DirectionFunction ( const DirectionFunction df)
inline

Definition at line 70 of file DirectionFunction.h.

◆ ~DirectionFunction()

virtual bpp::DirectionFunction::~DirectionFunction ( )
inlinevirtual

Definition at line 87 of file DirectionFunction.h.

Member Function Documentation

◆ autoParameter()

void DirectionFunction::autoParameter ( )

Definition at line 95 of file DirectionFunction.cpp.

References bpp::AutoParameter::setMessageHandler().

◆ clone()

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

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

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 89 of file DirectionFunction.h.

References DirectionFunction().

◆ f()

◆ getConstraintPolicy()

std::string bpp::DirectionFunction::getConstraintPolicy ( ) const
inline

Definition at line 103 of file DirectionFunction.h.

References constraintPolicy_.

◆ getFunction()

Function* bpp::DirectionFunction::getFunction ( ) const
inline

Definition at line 105 of file DirectionFunction.h.

References function_.

◆ getFunctionParameters()

ParameterList bpp::DirectionFunction::getFunctionParameters ( ) const
inline
Returns
The set of parameters associated to the function, as specified by the init() method.

Definition at line 109 of file DirectionFunction.h.

References p_.

◆ getNamespace() [1/2]

std::string bpp::ParametrizableAdapter::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 222 of file Parametrizable.h.

◆ 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()

size_t bpp::DirectionFunction::getNumberOfParameters ( ) const
inlinevirtual

Get the number of parameters.

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

Implements bpp::Parametrizable.

Definition at line 110 of file DirectionFunction.h.

References p_, and bpp::ParameterList::size().

◆ getParameter() [1/2]

const Parameter& bpp::ParametrizableAdapter::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 214 of file Parametrizable.h.

References bpp::ParametrizableAdapter::parameter_.

◆ 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::ParametrizableAdapter::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 223 of file Parametrizable.h.

◆ 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()

const ParameterList & DirectionFunction::getParameters ( ) const
virtual

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 70 of file DirectionFunction.cpp.

Referenced by bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ getParameters_()

ParameterList & DirectionFunction::getParameters_ ( )
protectedvirtual

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 75 of file DirectionFunction.cpp.

◆ getParameterValue() [1/2]

double bpp::ParametrizableAdapter::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 215 of file Parametrizable.h.

◆ 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().

◆ getValue()

double DirectionFunction::getValue ( ) const
virtual

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 63 of file DirectionFunction.cpp.

◆ hasParameter() [1/2]

bool bpp::ParametrizableAdapter::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 212 of file Parametrizable.h.

References bpp::ParameterList::hasParameter(), and bpp::ParametrizableAdapter::parameters_.

◆ 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().

◆ ignoreConstraints()

void DirectionFunction::ignoreConstraints ( )

Definition at line 107 of file DirectionFunction.cpp.

◆ init()

void DirectionFunction::init ( const ParameterList p,
const std::vector< double > &  xi 
)

◆ matchParametersValues() [1/2]

bool bpp::ParametrizableAdapter::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 219 of file Parametrizable.h.

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

Referenced by bpp::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::BppODiscreteDistributionFormat::initialize_(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), and bpp::InfinityFunctionWrapper::matchParametersValues().

◆ operator=()

DirectionFunction& bpp::DirectionFunction::operator= ( const DirectionFunction df)
inline

Definition at line 74 of file DirectionFunction.h.

References constraintPolicy_, function_, messenger_, p_, params_, xi_, and xt_.

◆ setAllParametersValues() [1/2]

void bpp::ParametrizableAdapter::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 216 of file Parametrizable.h.

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

Referenced by bpp::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), and bpp::InfinityFunctionWrapper::setAllParametersValues().

◆ setConstraintPolicy()

void bpp::DirectionFunction::setConstraintPolicy ( const std::string &  constraintPolicy)
inline

◆ setMessageHandler()

void bpp::DirectionFunction::setMessageHandler ( OutputStream messenger)
inline

◆ setNamespace() [1/2]

void bpp::ParametrizableAdapter::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 221 of file Parametrizable.h.

◆ setNamespace() [2/2]

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

◆ setParameters()

void DirectionFunction::setParameters ( const ParameterList parameters)
virtual

Set the point where the function must be computed.

Parameters
parametersThe parameter set to pass to the function.

Implements bpp::Function.

Definition at line 49 of file DirectionFunction.cpp.

References bpp::ParameterList::setParameters().

◆ setParametersValues() [1/2]

void bpp::ParametrizableAdapter::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 218 of file Parametrizable.h.

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

Referenced by bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), and bpp::InfinityFunctionWrapper::setParametersValues().

◆ setParameterValue() [1/2]

void bpp::ParametrizableAdapter::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 217 of file Parametrizable.h.

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

Referenced by bpp::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().

Member Data Documentation

◆ constraintPolicy_

std::string bpp::DirectionFunction::constraintPolicy_
private

Definition at line 61 of file DirectionFunction.h.

Referenced by getConstraintPolicy(), operator=(), and setConstraintPolicy().

◆ function_

Function* bpp::DirectionFunction::function_
private

Definition at line 60 of file DirectionFunction.h.

Referenced by getFunction(), and operator=().

◆ messenger_

OutputStream* bpp::DirectionFunction::messenger_
private

Definition at line 62 of file DirectionFunction.h.

Referenced by operator=(), and setMessageHandler().

◆ p_

ParameterList bpp::DirectionFunction::p_
private

Definition at line 58 of file DirectionFunction.h.

Referenced by getFunctionParameters(), getNumberOfParameters(), and operator=().

◆ parameter_

Parameter bpp::ParametrizableAdapter::parameter_
protectedinherited

Definition at line 200 of file Parametrizable.h.

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

◆ parameters_

ParameterList bpp::ParametrizableAdapter::parameters_
protectedinherited

◆ params_

ParameterList bpp::DirectionFunction::params_
mutableprivate

Definition at line 58 of file DirectionFunction.h.

Referenced by operator=().

◆ xi_

std::vector<double> bpp::DirectionFunction::xi_
private

Definition at line 59 of file DirectionFunction.h.

Referenced by operator=().

◆ xt_

ParameterList bpp::DirectionFunction::xt_
private

Definition at line 58 of file DirectionFunction.h.

Referenced by operator=().


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