bpp-core  2.1.0
bpp::DerivableFirstOrderWrapper Class Reference

General class that wraps a function into another one. This class is meant to be derivated and just provides a general framework. More...

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

+ Inheritance diagram for bpp::DerivableFirstOrderWrapper:
+ Collaboration diagram for bpp::DerivableFirstOrderWrapper:

List of all members.

Public Member Functions

 DerivableFirstOrderWrapper (DerivableFirstOrder *function)
void enableFirstOrderDerivatives (bool yn)
 Tell if derivatives must be computed.
bool enableFirstOrderDerivatives () const
 Tell if derivatives must be computed.
double getFirstOrderDerivative (const std::string &variable) const throw (Exception)
 Get the derivative of the function at the current point.
bool hasParameter (const std::string &name) const
 Tell if there is a parameter with specified name.
void setParameters (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Set the point where the function must be computed.
const ParameterListgetParameters () const throw (Exception)
 Get all parameters available.
const ParametergetParameter (const std::string &name) const throw (ParameterNotFoundException)
 Get the parameter with specified name.
double getValue () const throw (Exception)
 Get the value of the function at the current point.
double f (const ParameterList &parameters) throw (Exception)
 Get the value of the function according to a given set of parameters.
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.
size_t getNumberOfParameters () const
 Get the number of 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.
virtual Clonableclone () const =0
 Create a copy of this object and send a pointer to it.
DerivableFirstOrderclone () const =0
 Create a copy of this object and send a pointer to it.
virtual double df (const std::string &variable, const ParameterList &parameters) throw (Exception)
 Get the value of the first derivative of the function according to a given set of parameters.

Protected Attributes

Functionfunction_

Detailed Description

General class that wraps a function into another one. This class is meant to be derivated and just provides a general framework.

Definition at line 378 of file Functions.h.


Constructor & Destructor Documentation


Member Function Documentation

virtual Clonable* bpp::Clonable::clone ( ) const [pure virtual, inherited]

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

Returns:
A pointer toward the copy object.

Implemented in bpp::TestFunction, bpp::InfinityDerivableSecondOrderWrapper, bpp::InfinityDerivableFirstOrderWrapper, bpp::InfinityFunctionWrapper, bpp::StdErr, bpp::FunctionStopCondition, bpp::StdOut, bpp::LinearMatrix< Scalar >, bpp::PlaceboTransformedParameter, bpp::StlOutputStreamWrapper, bpp::ParametersStopCondition, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::IntervalTransformedParameter, bpp::MetaOptimizer, bpp::StlOutputStream, bpp::DerivableSecondOrder, bpp::Parameter, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::IntervalConstraint, bpp::RowMatrix< Scalar >, bpp::RowMatrix< double >, bpp::RowMatrix< Real >, bpp::LowMemoryRescaledHmmLikelihood, bpp::NullOutputStream, bpp::LogsumHmmLikelihood, bpp::Simplex, bpp::RTransformedParameter, bpp::RescaledHmmLikelihood, bpp::DerivableFirstOrder, bpp::Optimizer, bpp::DownhillSimplexMethod, bpp::AbstractNumericalDerivative, bpp::SimpleDiscreteDistribution, bpp::DirichletDiscreteDistribution, bpp::DualityDiagram, bpp::ReparametrizationFunctionWrapper, bpp::PrincipalComponentAnalysis, bpp::TruncatedExponentialDiscreteDistribution, bpp::DataTable, bpp::MetaOptimizerInfos, bpp::MixtureOfDiscreteDistributions, bpp::NewtonBacktrackOneDimension, bpp::AutoParameter, bpp::FivePointsNumericalDerivative, bpp::ParameterListener, bpp::ThreePointsNumericalDerivative, bpp::UNode, bpp::InvariantMixedDiscreteDistribution, bpp::AliasParameterListener, bpp::PowellMultiDimensions, bpp::Range< T >, bpp::OutputStream, bpp::BrentOneDimension, bpp::GammaDiscreteDistribution, bpp::GoldenSectionSearch, bpp::DirectionFunction, bpp::TwoPointsNumericalDerivative, bpp::BetaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::BppVector< TYPE >, bpp::CorrespondenceAnalysis, bpp::Point2D< T >, bpp::Number< T >, bpp::BppString, bpp::BasicTNode, bpp::ParameterList, bpp::ContingencyTableTest, bpp::Font, bpp::BfgsMultiDimensions, bpp::BppBoolean, bpp::TNode, bpp::HmmLikelihood, bpp::GaussianDiscreteDistribution, bpp::NewtonBacktrackOneDimension::NBODStopCondition, bpp::OptimizationStopCondition, bpp::ParameterEvent, bpp::UniformDiscreteDistribution, bpp::ConstantDistribution, bpp::DiscreteDistribution, bpp::MultipleDiscreteDistribution, bpp::ConjugateGradientMultiDimensions, bpp::DownhillSimplexMethod::DSMStopCondition, bpp::RGBColor, bpp::BrentOneDimension::BODStopCondition, bpp::ONode, bpp::GoldenSectionSearch::GSSStopCondition, bpp::PowellMultiDimensions::PMDStopCondition, bpp::SimpleMultiDimensions, bpp::SimpleNewtonMultiDimensions, bpp::HmmEmissionProbabilities, bpp::Constraint, bpp::TransformedParameter, and bpp::NewtonOneDimension.

virtual double bpp::DerivableFirstOrder::df ( const std::string &  variable,
const ParameterList parameters 
) throw (Exception) [inline, virtual, inherited]

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

References bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::Function::setParameters().

Tell if derivatives must be computed.

Parameters:
ynyes/no

Implements bpp::DerivableFirstOrder.

Definition at line 386 of file Functions.h.

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

Tell if derivatives must be computed.

Returns:
yes/no

Implements bpp::DerivableFirstOrder.

Definition at line 390 of file Functions.h.

References bpp::FunctionWrapper::function_.

Referenced by enableFirstOrderDerivatives().

double bpp::FunctionWrapper::f ( const ParameterList parameters) throw (Exception) [inline, virtual, inherited]

Get the value of the function according to a given set of parameters.

Parameters:
parametersThe parameter set to pass to the function.
Returns:
The value of the function with the given parameter set.
Exceptions:
ExceptionIf an error occured.

Reimplemented from bpp::Function.

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 316 of file Functions.h.

References bpp::Function::f(), and bpp::FunctionWrapper::function_.

double bpp::DerivableFirstOrderWrapper::getFirstOrderDerivative ( const std::string &  variable) const throw (Exception) [inline, virtual]

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

Definition at line 394 of file Functions.h.

References bpp::FunctionWrapper::function_.

std::string bpp::FunctionWrapper::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 360 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNamespace().

size_t bpp::FunctionWrapper::getNumberOfParameters ( ) const [inline, virtual, inherited]

Get the number of parameters.

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

Implements bpp::Parametrizable.

Definition at line 350 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNumberOfParameters().

const Parameter& bpp::FunctionWrapper::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 306 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameter().

std::string bpp::FunctionWrapper::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 365 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterNameWithoutNamespace().

const ParameterList& bpp::FunctionWrapper::getParameters ( ) const throw (Exception) [inline, virtual, inherited]

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

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameters().

double bpp::FunctionWrapper::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 321 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterValue().

double bpp::FunctionWrapper::getValue ( ) const throw (Exception) [inline, virtual, inherited]

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.

Reimplemented in bpp::InfinityFunctionWrapper, bpp::FivePointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, and bpp::TwoPointsNumericalDerivative.

Definition at line 311 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Function::getValue().

Referenced by bpp::AbstractNumericalDerivative::f().

bool bpp::FunctionWrapper::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 290 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::hasParameter().

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

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 344 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::matchParametersValues().

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

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 326 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setAllParametersValues().

void bpp::FunctionWrapper::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 355 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setNamespace().

void bpp::FunctionWrapper::setParameters ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException) [inline, virtual, inherited]

Set the point where the function must be computed.

Parameters:
parametersThe parameter set to pass to the function.

Implements bpp::Function.

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 295 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Function::setParameters().

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

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 338 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setParametersValues().

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

Reimplemented in bpp::InfinityFunctionWrapper, and bpp::AbstractNumericalDerivative.

Definition at line 332 of file Functions.h.

References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setParameterValue().


Member Data Documentation

Function* bpp::FunctionWrapper::function_ [protected, inherited]

Definition at line 278 of file Functions.h.

Referenced by enableFirstOrderDerivatives(), bpp::DerivableSecondOrderWrapper::enableSecondOrderDerivatives(), bpp::FunctionWrapper::f(), getFirstOrderDerivative(), bpp::InfinityDerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::FunctionWrapper::getNamespace(), bpp::FunctionWrapper::getNumberOfParameters(), bpp::FunctionWrapper::getParameter(), bpp::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::FunctionWrapper::getParameters(), bpp::FunctionWrapper::getParameterValue(), bpp::DerivableSecondOrderWrapper::getSecondOrderDerivative(), bpp::InfinityDerivableSecondOrderWrapper::getSecondOrderDerivative(), bpp::FunctionWrapper::getValue(), bpp::InfinityFunctionWrapper::getValue(), bpp::FunctionWrapper::hasParameter(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), bpp::InfinityFunctionWrapper::matchParametersValues(), bpp::FunctionWrapper::operator=(), bpp::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), bpp::InfinityFunctionWrapper::setAllParametersValues(), bpp::FunctionWrapper::setNamespace(), bpp::AbstractNumericalDerivative::setParameters(), bpp::FunctionWrapper::setParameters(), bpp::InfinityFunctionWrapper::setParameters(), bpp::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), bpp::InfinityFunctionWrapper::setParametersValues(), bpp::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().


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