bpp-core  2.1.0
bpp::DirectionFunction Class Reference

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

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

List of all members.

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.
void setParameters (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Set the point where the function must be computed.
double getValue () const throw (Exception)
 Get the value of the function at the current point.
const ParameterListgetParameters () const throw (Exception)
 Get all parameters available.
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.
virtual double f (const ParameterList &parameters) throw (Exception)
 Get the value of the function according to a given set of parameters.
virtual bool hasParameter (const std::string &name) const =0
 Tell if there is a parameter with specified name.
virtual const ParametergetParameter (const std::string &name) const =0 throw (ParameterNotFoundException)
 Get the parameter with specified name.
virtual double getParameterValue (const std::string &name) const =0 throw (ParameterNotFoundException)
 Get the value for parameter of name 'name'.
virtual void setAllParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Set the parameters values to be equals to those of parameters.
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.
virtual void setParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters.
virtual bool matchParametersValues (const ParameterList &parameters)=0 throw (ConstraintException)
 Update the parameters from parameters.
virtual void setNamespace (const std::string &prefix)=0
 Set the namespace for the parameter names.
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.
The Parametrizable interface.
bool hasParameter (const std::string &name) const
 Tell if there is a parameter with specified name.
const ParametergetParameter (const std::string &name) const throw (ParameterNotFoundException)
 Get the parameter with specified name.
double getParameterValue (const std::string &name) const throw (ParameterNotFoundException)
 Get the value for parameter of name 'name'.
void setAllParametersValues (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Set the parameters values to be equals to those of parameters.
void setParameterValue (const std::string &name, double value) throw (ParameterNotFoundException, ConstraintException)
 Set the value of parameter with name name to be equal to value.
void setParametersValues (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters.
bool matchParametersValues (const ParameterList &parameters) throw (ConstraintException)
 Update the parameters from parameters.
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names.
std::string getNamespace () const
std::string getParameterNameWithoutNamespace (const std::string &name) const
 Resolves a parameter name according to the current namespace.

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

Definition at line 65 of file DirectionFunction.h.

Referenced by clone().

Definition at line 70 of file DirectionFunction.h.

virtual bpp::DirectionFunction::~DirectionFunction ( ) [inline, virtual]

Definition at line 87 of file DirectionFunction.h.


Member Function Documentation

DirectionFunction* bpp::DirectionFunction::clone ( ) const [inline, virtual]

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_.

Definition at line 104 of file DirectionFunction.h.

References function_.

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 virtual, inherited]
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 [inline, virtual, inherited]
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 [inline, virtual]

Get the number of parameters.

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

Reimplemented from bpp::ParametrizableAdapter.

Definition at line 109 of file DirectionFunction.h.

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

virtual const Parameter& bpp::Parametrizable::getParameter ( const std::string &  name) const throw (ParameterNotFoundException) [pure virtual, inherited]

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) [inline, virtual, inherited]

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 virtual, inherited]

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

std::string bpp::ParametrizableAdapter::getParameterNameWithoutNamespace ( const std::string &  name) const [inline, virtual, inherited]

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.

Reimplemented from bpp::ParametrizableAdapter.

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 virtual, inherited]

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) [inline, virtual, inherited]

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 virtual, inherited]

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 [inline, virtual, inherited]

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::ParameterList::hasParameter(), and bpp::ParametrizableAdapter::parameters_.

Definition at line 100 of file DirectionFunction.cpp.

virtual bool bpp::Parametrizable::matchParametersValues ( const ParameterList parameters) throw (ConstraintException) [pure virtual, inherited]

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) [inline, virtual, inherited]

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]

Definition at line 74 of file DirectionFunction.h.

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

virtual void bpp::Parametrizable::setAllParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException) [pure virtual, inherited]

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) [inline, virtual, inherited]

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]
virtual void bpp::Parametrizable::setNamespace ( const std::string &  prefix) [pure virtual, inherited]

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::AbstractParameterAliasable, bpp::MixtureOfDiscreteDistributions, 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) [inline, virtual, inherited]

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.

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 virtual, inherited]

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) [inline, virtual, inherited]

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 virtual, inherited]

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) [inline, virtual, inherited]

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

Definition at line 61 of file DirectionFunction.h.

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

Definition at line 60 of file DirectionFunction.h.

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

Definition at line 62 of file DirectionFunction.h.

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

Definition at line 193 of file Parametrizable.h.

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

Definition at line 58 of file DirectionFunction.h.

Referenced by operator=().

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

Definition at line 59 of file DirectionFunction.h.

Referenced by operator=().

Definition at line 58 of file DirectionFunction.h.

Referenced by operator=().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends