bpp-core
2.2.0
|
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>
Public Member Functions | |
DerivableFirstOrderWrapper (DerivableFirstOrder *function) | |
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 throw (Exception) |
Get the derivative of the function at the current point. More... | |
bool | hasParameter (const std::string &name) const |
Tell if there is a parameter with specified name. More... | |
void | setParameters (const ParameterList ¶meters) throw (ParameterNotFoundException, ConstraintException) |
Set the point where the function must be computed. More... | |
const ParameterList & | getParameters () const throw (Exception) |
Get all parameters available. More... | |
const Parameter & | getParameter (const std::string &name) const throw (ParameterNotFoundException) |
Get the parameter with specified name. More... | |
double | getValue () const throw (Exception) |
Get the value of the function at the current point. More... | |
double | f (const ParameterList ¶meters) throw (Exception) |
Get the value of the function according to a given set of parameters. More... | |
double | getParameterValue (const std::string &name) const throw (ParameterNotFoundException) |
Get the value for parameter of name 'name'. More... | |
void | setAllParametersValues (const ParameterList ¶meters) 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 ¶meters) throw (ParameterNotFoundException, ConstraintException) |
Update the parameters from parameters. More... | |
bool | matchParametersValues (const ParameterList ¶meters) throw (ConstraintException) |
Update the parameters from parameters. More... | |
size_t | getNumberOfParameters () const |
Get the number of 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... | |
virtual Clonable * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
DerivableFirstOrder * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
virtual double | df (const std::string &variable, const ParameterList ¶meters) throw (Exception) |
Get the value of the first derivative of the function according to a given set of parameters. More... | |
Protected Attributes | |
Function * | function_ |
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.
|
inline |
Definition at line 383 of file Functions.h.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implemented in bpp::TestFunction, bpp::InfinityDerivableSecondOrderWrapper, bpp::InfinityDerivableFirstOrderWrapper, bpp::InfinityFunctionWrapper, bpp::LinearMatrix< Scalar >, bpp::StdErr, bpp::FunctionStopCondition, bpp::StdOut, bpp::PlaceboTransformedParameter, bpp::ColMatrix< Scalar >, bpp::StlOutputStreamWrapper, bpp::ParametersStopCondition, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::IntervalTransformedParameter, bpp::BppUnsignedInteger, bpp::MetaOptimizer, bpp::StlOutputStream, bpp::IntervalConstraint, bpp::DerivableSecondOrder, bpp::Parameter, bpp::RescaledHmmLikelihood, bpp::BppInteger, bpp::LogsumHmmLikelihood, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::RowMatrix< Scalar >, bpp::RowMatrix< double >, bpp::RowMatrix< Real >, bpp::BppDouble, bpp::LowMemoryRescaledHmmLikelihood, bpp::Simplex, bpp::NullOutputStream, bpp::RTransformedParameter, bpp::ParametrizableCollection< N >, bpp::DerivableFirstOrder, bpp::Optimizer, bpp::Number< T >, bpp::Number< double >, bpp::Number< int >, bpp::Number< unsigned int >, bpp::DownhillSimplexMethod, bpp::AbstractNumericalDerivative, bpp::SimpleDiscreteDistribution, bpp::ThreePointsNumericalDerivative, bpp::DirichletDiscreteDistribution, bpp::FivePointsNumericalDerivative, bpp::DualityDiagram, bpp::ReparametrizationFunctionWrapper, bpp::PrincipalComponentAnalysis, bpp::TruncatedExponentialDiscreteDistribution, bpp::MetaOptimizerInfos, bpp::MixtureOfDiscreteDistributions, bpp::NewtonBacktrackOneDimension, bpp::AutoParameter, bpp::DataTable, bpp::ParameterListener, bpp::UNode, bpp::InvariantMixedDiscreteDistribution, bpp::AliasParameterListener, bpp::PowellMultiDimensions, bpp::Range< T >, bpp::OutputStream, bpp::BrentOneDimension, bpp::TwoPointsNumericalDerivative, bpp::GammaDiscreteDistribution, bpp::GoldenSectionSearch, bpp::DirectionFunction, bpp::BetaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::BppVector< TYPE >, bpp::CorrespondenceAnalysis, bpp::Point2D< T >, bpp::BppNotANumber, bpp::BppString, bpp::BasicTNode, bpp::HmmLikelihood, bpp::ParameterList, bpp::ContingencyTableTest, bpp::Font, bpp::BfgsMultiDimensions, bpp::FullHmmTransitionMatrix, bpp::BppBoolean, bpp::TNode, bpp::GaussianDiscreteDistribution, bpp::NewtonBacktrackOneDimension::NBODStopCondition, bpp::OptimizationStopCondition, bpp::ParameterEvent, bpp::UniformDiscreteDistribution, bpp::AutoCorrelationTransitionMatrix, 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::Constraint, bpp::HmmEmissionProbabilities, bpp::TransformedParameter, bpp::BppNumberI, and bpp::NewtonOneDimension.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implements bpp::Clonable.
Implemented in bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::DerivableSecondOrder, bpp::RescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::LowMemoryRescaledHmmLikelihood, bpp::AbstractNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::FivePointsNumericalDerivative, bpp::TwoPointsNumericalDerivative, and bpp::HmmLikelihood.
|
inlinevirtualinherited |
Get the value of the first derivative of the function according to a given set of parameters.
variable | The name of the ![]() ![]() |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 176 of file Functions.h.
References bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::Function::setParameters().
|
inlinevirtual |
Tell if derivatives must be computed.
yn | yes/no |
Implements bpp::DerivableFirstOrder.
Definition at line 386 of file Functions.h.
References enableFirstOrderDerivatives(), and bpp::FunctionWrapper::function_.
|
inlinevirtual |
Tell if derivatives must be computed.
Implements bpp::DerivableFirstOrder.
Definition at line 390 of file Functions.h.
References bpp::FunctionWrapper::function_.
Referenced by enableFirstOrderDerivatives().
|
inlinevirtualinherited |
Get the value of the function according to a given set of parameters.
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Reimplemented from bpp::Function.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 316 of file Functions.h.
References bpp::Function::f(), and bpp::FunctionWrapper::function_.
|
inlinevirtual |
Get the derivative of the function at the current point.
variable | The name of the ![]() ![]() |
Exception | If no point is specified or if an error occured. |
Implements bpp::DerivableFirstOrder.
Definition at line 394 of file Functions.h.
References bpp::FunctionWrapper::function_.
|
inlinevirtualinherited |
Implements bpp::Parametrizable.
Definition at line 360 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNamespace().
|
inlinevirtualinherited |
Get the number of parameters.
Implements bpp::Parametrizable.
Definition at line 350 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNumberOfParameters().
|
inlinevirtualinherited |
Get the parameter with specified name.
name | The name of the parameter to look for. |
ParameterNotFoundException | if 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().
|
inlinevirtualinherited |
Resolves a parameter name according to the current namespace.
Implements bpp::Parametrizable.
Definition at line 365 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterNameWithoutNamespace().
|
inlinevirtualinherited |
Get all parameters available.
Implements bpp::Parametrizable.
Definition at line 301 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameters().
|
inlinevirtualinherited |
Get the value for parameter of name 'name'.
name | The name of the parameter. |
Implements bpp::Parametrizable.
Definition at line 321 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterValue().
|
inlinevirtualinherited |
Get the value of the function at the current point.
Exception | If no point is specified or if an error occured. |
Implements bpp::Function.
Reimplemented in bpp::InfinityFunctionWrapper, 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().
|
inlinevirtualinherited |
Tell if there is a parameter with specified name.
name | The name of the parameter to look for. |
Implements bpp::Parametrizable.
Definition at line 290 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::hasParameter().
|
inlinevirtualinherited |
Update the parameters from parameters.
Only common parameters with parameters will be updated.
parameters | A list of parameters. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 344 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::matchParametersValues().
|
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 | A list with all parameters. |
ParameterNotFoundException | If a some parameter in the list is not in params. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 326 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setAllParametersValues().
|
inlinevirtualinherited |
Set the namespace for the parameter names.
prefix | The '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().
|
inlinevirtualinherited |
Set the point where the function must be computed.
parameters | The parameter set to pass to the function. |
Implements bpp::Function.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 295 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Function::setParameters().
|
inlinevirtualinherited |
Update the parameters from parameters.
parameters must be a subset of all parameters available.
parameters | A list containing all parameters to update. |
ParameterNotFoundException | If a some parameter in params is not in the list. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 338 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setParametersValues().
|
inlinevirtualinherited |
Set the value of parameter with name name to be equal to value.
name | the name of the parameter to set. |
value | The value of the parameter. |
ParameterNotFoundException | If no parameter in the list has the name name. |
ConstraintException | If value does not match the constraint associated to parameter name. |
Implements bpp::Parametrizable.
Reimplemented in bpp::InfinityFunctionWrapper.
Definition at line 332 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setParameterValue().
|
protectedinherited |
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().