bpp-core3
3.0.0
|
Some utilitary function for numerical calculus. More...
#include <Bpp/Numeric/NumTools.h>
Static Public Member Functions | |
template<class T > | |
static T | abs (T a) |
Get the magnitude of a value. More... | |
template<class T > | |
static T | sign (T a) |
Get the sign of a value. More... | |
template<class T > | |
static T | max (T a, T b) |
Get the max between 2 values. More... | |
template<class T > | |
static T | min (T a, T b) |
Get the min between 2 values. More... | |
template<class T > | |
static T | sign (T a, T b) |
Get the magnitude of a times the sign of b. More... | |
template<class T > | |
static T | sqr (T a) |
Get the square of a number. More... | |
template<class T > | |
static T | logsum (T lnx, T lny) |
Compute the logarithm of a sum from the sum of logarithms. More... | |
template<class T > | |
static void | swap (T &a, T &b) |
template<class T > | |
static void | shift (T &a, T &b, T c) |
template<class T > | |
static void | shift (T &a, T &b, T &c, T d) |
template<class T > | |
static T | fact (T n) |
template<class T > | |
static T | logFact (T n) |
static double | uniRoot (FunctionInterface &f, const std::string ¶m, double a, double b, double tolerance) |
Find one root of the given function. More... | |
static std::unique_ptr< RowMatrix< double > > | computeHessianMatrix (SecondOrderDerivable &function, const ParameterList ¶meters) |
Compute the Hessian matrix for a function at a given point. More... | |
Some utilitary function for numerical calculus.
Definition at line 19 of file NumTools.h.
|
inlinestatic |
Get the magnitude of a value.
This template function may work with any type for which the operators < and - are defined.
a | The value for which the magnitude must be returned. |
Definition at line 31 of file NumTools.h.
Referenced by bpp::OneDimensionOptimizationTools::bracketMinimum(), bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doStep(), bpp::GoldenSectionSearch::GSSStopCondition::getCurrentTolerance(), bpp::PowellMultiDimensions::PMDStopCondition::getCurrentTolerance(), bpp::BrentOneDimension::BODStopCondition::getCurrentTolerance(), and bpp::DownhillSimplexMethod::DSMStopCondition::getCurrentTolerance().
|
static |
Compute the Hessian matrix for a function at a given point.
function | A function with second order derivatives. |
parameters | The set of parameters for which to compute the hessian matrix. |
Definition at line 46 of file NumTools.cpp.
References bpp::ParameterList::getParameterNames(), and bpp::ParameterList::size().
Referenced by logFact().
|
inlinestatic |
|
inlinestatic |
Definition at line 128 of file NumTools.h.
References computeHessianMatrix(), logFact(), and uniRoot().
Referenced by logFact().
|
inlinestatic |
Compute the logarithm of a sum from the sum of logarithms.
The following formula is used:
see http://bozeman.genome.washington.edu/compbio/mbt599_2006/hmm_scaling_revised.pdf
lnx | The value. |
lny | The power |
Definition at line 96 of file NumTools.h.
Referenced by bpp::LogsumHmmLikelihood::computeBackward_(), and bpp::LogsumHmmLikelihood::computeForward_().
|
inlinestatic |
Get the max between 2 values.
This template function may work with any type for which the operator
is defined.
a,b | The two values to compare. |
Definition at line 53 of file NumTools.h.
Referenced by bpp::OneDimensionOptimizationTools::bracketMinimum().
|
inlinestatic |
Get the min between 2 values.
This template function may work with any type for which the operator < is defined.
a,b | The two values to compare. |
Definition at line 64 of file NumTools.h.
|
inlinestatic |
Definition at line 112 of file NumTools.h.
Referenced by bpp::BrentOneDimension::doStep().
|
inlinestatic |
Definition at line 117 of file NumTools.h.
|
inlinestatic |
Get the sign of a value.
This template function may work with any type for which the operators < and == are defined.
a | The value for which the sign must be returned. |
Definition at line 42 of file NumTools.h.
Referenced by bpp::OneDimensionOptimizationTools::bracketMinimum(), and bpp::BrentOneDimension::doStep().
|
inlinestatic |
Get the magnitude of a times the sign of b.
a | The value whose magnitude must be used. |
b | The value whose sign must be used. |
Definition at line 73 of file NumTools.h.
|
inlinestatic |
Get the square of a number.
a | The value. |
Definition at line 81 of file NumTools.h.
Referenced by bpp::PowellMultiDimensions::doStep().
|
inlinestatic |
Definition at line 105 of file NumTools.h.
|
static |
Find one root of the given function.
f | The function to analyse. |
param | The name of the parameter to solve. |
a | Lower bound of initial interval. |
b | Upper bound of initial interval. |
tolerance | The final precision requested. |
Exception | If something bad happened or if the initial interval do not contains a root. |
Definition at line 13 of file NumTools.cpp.
References bpp::ParameterList::addParameter(), and bpp::FunctionInterface::f().
Referenced by logFact().