bpp-core3
3.0.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 | |
DerivableSecondOrderWrapper (DerivableSecondOrder *function) | |
void | enableSecondOrderDerivatives (bool yn) |
Tell if derivatives must be computed. More... | |
bool | enableSecondOrderDerivatives () const |
Tell if derivatives must be computed. More... | |
double | getSecondOrderDerivative (const std::string &variable) const |
Get the second order derivative of the function at the current point. More... | |
double | getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const |
Get the value of the cross derivative of the function according to a given set of parameters. More... | |
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 |
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) |
Set the point where the function must be computed. More... | |
const ParameterList & | getParameters () const |
Get all parameters available. More... | |
const Parameter & | getParameter (const std::string &name) const |
Get the parameter with specified name. More... | |
double | getValue () const |
Get the value of the function at the current point. More... | |
double | f (const ParameterList ¶meters) |
Get the value of the function according to a given set of parameters. More... | |
double | getParameterValue (const std::string &name) const |
Get the value for parameter of name 'name'. More... | |
void | setAllParametersValues (const ParameterList ¶meters) |
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 ¶meters) |
Update the parameters from parameters. More... | |
bool | matchParametersValues (const ParameterList ¶meters) |
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) |
Get the value of the first derivative of the function according to a given set of parameters. More... | |
DerivableSecondOrder * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
virtual double | d2f (const std::string &variable, const ParameterList ¶meters) |
Get the value of the second order derivative of the function according to a given set of parameters. More... | |
virtual double | d2f (const std::string &variable1, const std::string &variable2, const ParameterList ¶meters) |
Get the value of the cross derivative of the function according to a given set of parameters. More... | |
Protected Member Functions | |
ParameterList & | getParameters_ () |
Get all parameters available. 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 398 of file Functions.h.
|
inline |
Definition at line 403 of file Functions.h.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implemented in bpp::TransformedParameter, bpp::MultipleDiscreteDistribution, bpp::DiscreteDistribution, bpp::ParameterListener, bpp::BppNumberI, bpp::HmmLikelihood, bpp::HmmEmissionProbabilities, bpp::Optimizer, bpp::OptimizationStopCondition, bpp::DerivableSecondOrder, bpp::DerivableFirstOrder, bpp::AbstractNumericalDerivative, bpp::Constraint, bpp::OutputStream, bpp::PlaceboTransformedParameter, bpp::IntervalTransformedParameter, bpp::RTransformedParameter, bpp::Table< T >, bpp::PrincipalComponentAnalysis, bpp::DualityDiagram, bpp::CorrespondenceAnalysis, bpp::ContingencyTableTest, bpp::Range< T >, bpp::UniformDiscreteDistribution, bpp::TruncatedExponentialDiscreteDistribution, bpp::Simplex, bpp::SimpleDiscreteDistribution, bpp::MixtureOfDiscreteDistributions, bpp::InvariantMixedDiscreteDistribution, bpp::GaussianDiscreteDistribution, bpp::GammaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::DirichletDiscreteDistribution, bpp::ConstantDistribution, bpp::BetaDiscreteDistribution, bpp::ParametrizableCollection< N >, bpp::ParameterList, bpp::Parameter, bpp::ParameterEvent, bpp::BppUnsignedInteger, bpp::BppInteger, bpp::BppDouble, bpp::Number< T >, bpp::Number< double >, bpp::Number< int >, bpp::Number< unsigned int >, bpp::BppNotANumber, bpp::LinearMatrix< Scalar >, bpp::ColMatrix< Scalar >, bpp::RowMatrix< Scalar >, bpp::RowMatrix< double >, bpp::RowMatrix< Real >, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::FullHmmTransitionMatrix, bpp::AutoCorrelationTransitionMatrix, bpp::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::SimpleNewtonMultiDimensions, bpp::SimpleMultiDimensions, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::ReparametrizationFunctionWrapper, bpp::PowellMultiDimensions, bpp::PowellMultiDimensions::PMDStopCondition, bpp::FunctionStopCondition, bpp::ParametersStopCondition, bpp::NegativeOperator, bpp::MathOperator, bpp::FunctionOperator< F >, bpp::ConstantOperator, bpp::ComputationTree, bpp::BinaryOperator, bpp::NewtonOneDimension, bpp::NewtonBacktrackOneDimension, bpp::NewtonBacktrackOneDimension::NBODStopCondition, bpp::MetaOptimizer, bpp::MetaOptimizerInfos, bpp::GoldenSectionSearch, bpp::GoldenSectionSearch::GSSStopCondition, bpp::TestFunction, bpp::InfinityDerivableSecondOrderWrapper, bpp::InfinityDerivableFirstOrderWrapper, bpp::InfinityFunctionWrapper, bpp::FivePointsNumericalDerivative, bpp::DownhillSimplexMethod, bpp::DownhillSimplexMethod::DSMStopCondition, bpp::DirectionFunction, bpp::ConjugateGradientMultiDimensions, bpp::BrentOneDimension, bpp::BrentOneDimension::BODStopCondition, bpp::BfgsMultiDimensions, bpp::DataTable, bpp::IntervalConstraint, bpp::AutoParameter, bpp::AliasParameterListener, bpp::StdErr, bpp::StdOut, bpp::StlOutputStreamWrapper, bpp::StlOutputStream, bpp::NullOutputStream, bpp::RGBColor, bpp::Point2D< T >, bpp::Font, bpp::GlobalGraph, bpp::AssociationTreeGraphImplObserver< N, E, TreeGraphImpl >, bpp::AssociationGraphImplObserver< N, E, GraphImpl >, bpp::AssociationGraphImplObserver< N, E, DAGraphImpl >, bpp::AssociationGraphImplObserver< N, E, TreeGraphImpl >, bpp::AssociationDAGraphImplObserver< N, E, DAGraphImpl >, bpp::BppVector< T >, bpp::BppString, and bpp::BppBoolean.
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::LogsumHmmLikelihood::LogsumHmmLikelihood(), and bpp::LogsumHmmLikelihood::operator=().
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implements bpp::Clonable.
Implemented in bpp::HmmLikelihood, bpp::DerivableSecondOrder, bpp::AbstractNumericalDerivative, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::ReparametrizationDerivableFirstOrderWrapper, and bpp::FivePointsNumericalDerivative.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implements bpp::DerivableFirstOrder.
Implemented in bpp::HmmLikelihood, bpp::AbstractNumericalDerivative, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::ReparametrizationDerivableSecondOrderWrapper, and bpp::FivePointsNumericalDerivative.
|
inlinevirtualinherited |
Get the value of the second order derivative of the function according to a given set of parameters.
variable | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 228 of file Functions.h.
References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::setParameters().
|
inlinevirtualinherited |
Get the value of the cross derivative of the function according to a given set of parameters.
variable1 | The name of the variable in . |
variable2 | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 255 of file Functions.h.
References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::setParameters().
|
inlinevirtualinherited |
Get the value of the first derivative of the function according to a given set of parameters.
variable | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 173 of file Functions.h.
References bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::Function::setParameters().
|
inlinevirtualinherited |
Tell if derivatives must be computed.
Implements bpp::DerivableFirstOrder.
Definition at line 382 of file Functions.h.
References bpp::FunctionWrapper::function_.
Referenced by bpp::DerivableFirstOrderWrapper::enableFirstOrderDerivatives().
|
inlinevirtualinherited |
Tell if derivatives must be computed.
yn | yes/no |
Implements bpp::DerivableFirstOrder.
Definition at line 377 of file Functions.h.
References bpp::DerivableFirstOrderWrapper::enableFirstOrderDerivatives(), and bpp::FunctionWrapper::function_.
|
inlinevirtual |
Tell if derivatives must be computed.
Implements bpp::DerivableSecondOrder.
Definition at line 411 of file Functions.h.
References bpp::FunctionWrapper::function_.
Referenced by enableSecondOrderDerivatives().
|
inlinevirtual |
Tell if derivatives must be computed.
yn | yes/no |
Implements bpp::DerivableSecondOrder.
Definition at line 406 of file Functions.h.
References enableSecondOrderDerivatives(), and bpp::FunctionWrapper::function_.
|
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 307 of file Functions.h.
References bpp::Function::f(), and bpp::FunctionWrapper::function_.
|
inlinevirtualinherited |
Get the derivative of the function at the current point.
variable | The name of the variable in . |
Exception | If no point is specified or if an error occured. |
Implements bpp::DerivableFirstOrder.
Definition at line 387 of file Functions.h.
References bpp::FunctionWrapper::function_.
|
inlinevirtualinherited |
Implements bpp::Parametrizable.
Definition at line 347 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getNamespace().
|
inlinevirtualinherited |
Get the number of parameters.
Implements bpp::Parametrizable.
Definition at line 337 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 297 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 352 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterNameWithoutNamespace().
|
inlinevirtualinherited |
Get all parameters available.
Implements bpp::Parametrizable.
Definition at line 292 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameters().
|
inlineprotectedvirtualinherited |
Get all parameters available.
Implements bpp::Parametrizable.
Definition at line 358 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 312 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::getParameterValue().
|
inlinevirtual |
Get the second order derivative of the function at the current point.
variable | The name of the variable in . |
Exception | If no point is specified or if an error occured. |
Implements bpp::DerivableSecondOrder.
Definition at line 416 of file Functions.h.
References bpp::FunctionWrapper::function_.
Referenced by getSecondOrderDerivative().
|
inlinevirtual |
Get the value of the cross derivative of the function according to a given set of parameters.
variable1 | The name of the variable in . |
variable2 | The name of the variable in . |
Exception | If an error occured. |
Implements bpp::DerivableSecondOrder.
Definition at line 421 of file Functions.h.
References bpp::FunctionWrapper::function_, and getSecondOrderDerivative().
|
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::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, and bpp::InfinityFunctionWrapper.
Definition at line 302 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 282 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 332 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 317 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 342 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 287 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 327 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 322 of file Functions.h.
References bpp::FunctionWrapper::function_, and bpp::Parametrizable::setParameterValue().
|
protectedinherited |
Definition at line 270 of file Functions.h.
Referenced by bpp::DerivableFirstOrderWrapper::enableFirstOrderDerivatives(), enableSecondOrderDerivatives(), bpp::FunctionWrapper::f(), bpp::DerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::InfinityDerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::FunctionWrapper::getNamespace(), bpp::FunctionWrapper::getNumberOfParameters(), bpp::FunctionWrapper::getParameter(), bpp::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::FunctionWrapper::getParameters(), bpp::FunctionWrapper::getParameters_(), bpp::FunctionWrapper::getParameterValue(), 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().