bpp-core  2.1.0
 All Classes Namespaces Files Functions Variables Typedefs Friends
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) throw (ParameterNotFoundException, ConstraintException)
 Set the point where the function must be computed. More...
 
double getValue () const throw (Exception)
 Get the value of the function at the current point. More...
 
const ParameterListgetParameters () const throw (Exception)
 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) throw (Exception)
 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 throw (ParameterNotFoundException)
 Get the parameter with specified name. More...
 
virtual double getParameterValue (const std::string &name) const =0 throw (ParameterNotFoundException)
 Get the value for parameter of name 'name'. More...
 
virtual void setAllParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Set the parameters values to be equals to those of parameters. More...
 
virtual void setParameterValue (const std::string &name, double value)=0 throw (ParameterNotFoundException, ConstraintException)
 Set the value of parameter with name name to be equal to value. More...
 
virtual void setParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters. More...
 
virtual bool matchParametersValues (const ParameterList &parameters)=0 throw (ConstraintException)
 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 throw (ParameterNotFoundException)
 Get the parameter with specified name. More...
 
double getParameterValue (const std::string &name) const throw (ParameterNotFoundException)
 Get the value for parameter of name 'name'. More...
 
void setAllParametersValues (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value) throw (ParameterNotFoundException, ConstraintException)
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters) throw (ConstraintException)
 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 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

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

Definition at line 65 of file DirectionFunction.h.

Referenced by clone().

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

Definition at line 70 of file DirectionFunction.h.

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

Definition at line 87 of file DirectionFunction.h.

Member Function Documentation

void DirectionFunction::autoParameter ( )

Definition at line 88 of file DirectionFunction.cpp.

References bpp::AutoParameter::setMessageHandler().

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

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

Definition at line 102 of file DirectionFunction.h.

References constraintPolicy_.

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

Definition at line 104 of file DirectionFunction.h.

References function_.

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

Definition at line 108 of file DirectionFunction.h.

References p_.

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::FunctionWrapper::getNamespace().

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 221 of file Parametrizable.h.

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 109 of file DirectionFunction.h.

References p_.

virtual const Parameter& bpp::Parametrizable::getParameter ( const std::string &  name) const throw (ParameterNotFoundException)
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::FunctionWrapper::getParameter().

const Parameter& bpp::ParametrizableAdapter::getParameter ( const std::string &  name) const throw (ParameterNotFoundException)
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 208 of file Parametrizable.h.

References bpp::ParametrizableAdapter::parameter_.

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::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::BppODiscreteDistributionFormat::read(), bpp::BppOParametrizableFormat::write(), and bpp::BppOParametrizableFormat::write().

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 222 of file Parametrizable.h.

const ParameterList & DirectionFunction::getParameters ( ) const throw (Exception)
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().

virtual double bpp::Parametrizable::getParameterValue ( const std::string &  name) const throw (ParameterNotFoundException)
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::FunctionWrapper::getParameterValue(), and bpp::BppODiscreteDistributionFormat::read().

double bpp::ParametrizableAdapter::getParameterValue ( const std::string &  name) const throw (ParameterNotFoundException)
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 209 of file Parametrizable.h.

double DirectionFunction::getValue ( ) const throw (Exception)
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.

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::FunctionWrapper::hasParameter().

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 206 of file Parametrizable.h.

References bpp::ParametrizableAdapter::parameters_.

void DirectionFunction::ignoreConstraints ( )

Definition at line 100 of file DirectionFunction.cpp.

void DirectionFunction::init ( const ParameterList p,
const std::vector< double > &  xi 
)
virtual bool bpp::Parametrizable::matchParametersValues ( const ParameterList parameters) throw (ConstraintException)
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::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), and bpp::InfinityFunctionWrapper::matchParametersValues().

bool bpp::ParametrizableAdapter::matchParametersValues ( const ParameterList parameters) throw (ConstraintException)
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 217 of file Parametrizable.h.

DirectionFunction& bpp::DirectionFunction::operator= ( const DirectionFunction df)
inline
virtual void bpp::Parametrizable::setAllParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException)
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::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), and bpp::InfinityFunctionWrapper::setAllParametersValues().

void bpp::ParametrizableAdapter::setAllParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException)
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 211 of file Parametrizable.h.

void bpp::DirectionFunction::setConstraintPolicy ( const std::string &  constraintPolicy)
inline
void bpp::DirectionFunction::setMessageHandler ( OutputStream messenger)
inline
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::MixtureOfDiscreteDistributions, bpp::AbstractParameterAliasable, bpp::AbstractParametrizable, and bpp::InvariantMixedDiscreteDistribution.

Referenced by bpp::InvariantMixedDiscreteDistribution::InvariantMixedDiscreteDistribution(), bpp::InvariantMixedDiscreteDistribution::setNamespace(), and bpp::FunctionWrapper::setNamespace().

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 220 of file Parametrizable.h.

void DirectionFunction::setParameters ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException)
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 48 of file DirectionFunction.cpp.

virtual void bpp::Parametrizable::setParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException)
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::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), and bpp::InfinityFunctionWrapper::setParametersValues().

void bpp::ParametrizableAdapter::setParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException)
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 215 of file Parametrizable.h.

virtual void bpp::Parametrizable::setParameterValue ( const std::string &  name,
double  value 
) throw (ParameterNotFoundException, ConstraintException)
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::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().

void bpp::ParametrizableAdapter::setParameterValue ( const std::string &  name,
double  value 
) throw (ParameterNotFoundException, ConstraintException)
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 213 of file Parametrizable.h.

Member Data Documentation

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

Definition at line 61 of file DirectionFunction.h.

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

Function* bpp::DirectionFunction::function_
private

Definition at line 60 of file DirectionFunction.h.

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

OutputStream* bpp::DirectionFunction::messenger_
private

Definition at line 62 of file DirectionFunction.h.

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

ParameterList bpp::DirectionFunction::p_
mutableprivate
Parameter bpp::ParametrizableAdapter::parameter_
protectedinherited

Definition at line 193 of file Parametrizable.h.

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

ParameterList bpp::ParametrizableAdapter::parameters_
protectedinherited
ParameterList bpp::DirectionFunction::params_
mutableprivate

Definition at line 58 of file DirectionFunction.h.

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

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

Definition at line 59 of file DirectionFunction.h.

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

ParameterList bpp::DirectionFunction::xt_
mutableprivate

Definition at line 58 of file DirectionFunction.h.

Referenced by operator=().


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