|
latest version v1.9 - last update 24 Nov 2005 |
|
Collaboration diagram for Basic Math Functions:
|
Functions | |
| template<class T> | |
| bool | lti::closeTo (const T &a, const T &b, const T epsilon=std::numeric_limits< T >::epsilon()) |
| template<class T> | |
| bool | lti::closeToZero (const T &a, const T epsilon=std::numeric_limits< T >::epsilon()) |
| template<class T> | |
| T | lti::round (T x) |
| template<class T> | |
| int | lti::iround (T x) |
| template<class T> | |
| long | lti::lround (T x) |
| template<class T> | |
| void | lti::exchange (T &a, T &b) |
| template<class T> | |
| T | lti::min (const T x, const T y) |
| template<class T> | |
| T | lti::max (const T x, const T y) |
| template<class T> | |
| T | lti::min (const T x, const T y, const T z) |
| template<class T> | |
| T | lti::max (const T x, const T y, const T z) |
| template<class T> | |
| T | lti::lnGamma (const T &x) |
| double | lti::factorial (const int x) |
| double | lti::lnFactorial (const int x) |
| double | lti::binomial (const int n, const int k) |
| byte | lti::abs (byte x) |
| int | lti::abs (int x) |
| float | lti::abs (float x) |
| double | lti::abs (const double &x) |
| template<class T> | |
| T | lti::absdiff (const T &x, const T &y) |
| template<class T> | |
| T | lti::rectify (const T &x) |
| template<class T> | |
| T | lti::sqr (const T &x) |
| int | lti::sqrt (int x) |
| unsigned int | lti::sqrt (unsigned int x) |
| float | lti::sqrt (float x) |
| double | lti::sqrt (const double &x) |
| float | lti::sigmoid (const float x) |
| double | lti::sigmoid (const double &x) |
| double | lti::sigmoid (const int x) |
| template<class T> | |
| T | lti::signum (T x) |
| template<class T> | |
| T | lti::signum0 (T x) |
| template<class T> | |
| bool | lti::even (const T x) |
| template<class T> | |
| bool | lti::odd (const T x) |
| template<class T> | |
| T | lti::betai (const T &a, const T &b, const T &x) |
Variables | |
| const double | lti::Pi = 3.1415926535897932 |
| const double | lti::NaN = log(-1.0) |
| const double | lti::Inf = tan(Pi/2.0) |
|
|
absolute value for any type
|
|
|
absolute value for any type
|
|
|
absolute value for integers
|
|
|
absolute value for signed bytes
|
|
||||||||||||||||
|
absolute difference for the given values equals if (x>y) then (x-y) else (y-x). Note that with complex numbers it does not return the real abs value. |
|
||||||||||||||||||||
|
Compute the incomplete beta function.
|
|
||||||||||||
|
Returns the binomial coefficient defined by
.
|
|
||||||||||||||||||||
|
Returns true if a is close to b, i.e. if abs(a-b) <= epsilon. This is always better than testing equality with a==b for floating point types. For default epsilon integers are tested for equality. Note: Do not used for unsigned types T.
|
|
||||||||||||||||
|
Returns true if a is close to T(0), i.e. if abs(a) <= epsilon. This is always better than testing equality with a==0. for floating point types. For default epsilon integers are tested for ==0 automagically. Note: Do not used for unsigned types T.
|
|
||||||||||
|
Return true if the given number is an even number. For floating point types, this function will return true only if the number is exacltly an integer and it is even. |
|
||||||||||||||||
|
Exchange the content of the two given variables. It works for all types T that properly define the copy constructor and operator=().
|
|
|
Returns the factorial of x. Note that the returned type is always the same as the input type. So, if you require very large faculty values, just cast the input to double. |
|
||||||||||
|
round any float type mathematicly and return an integer
|
|
|
Returns the natural logarithm of the factorial of x.
|
|
||||||||||
|
Returns the value ln( gamma(x) ) for xx>0.
|
|
||||||||||
|
round any float type mathematicly and return an long integer
|
|
||||||||||||||||||||
|
Get the maximum of x, y and z.
|
|
||||||||||||||||
|
Get the maximum of x and y.
|
|
||||||||||||||||||||
|
Get the minimum of x, y and z.
|
|
||||||||||||||||
|
Get the minimum of x and y.
|
|
||||||||||
|
Return true if the given number is an odd number. For floating point types, this function will return true only if the number is exacltly an integer and it is odd. |
|
||||||||||
|
rectify is 0 if x<0 or x otherwise
|
|
||||||||||
|
round any float type mathematicly
|
|
|
sigmoid for ints
|
|
|
sigmoid for doubles
|
|
|
sigmoid for floats
|
|
||||||||||
|
signum of x (for x==0 -> signum = 1) (
|
|
||||||||||
|
signum of x (for x==0 -> signum = 0) (
|
|
||||||||||
|
square (x*x)
|
|
|
square root
|
|
|
square root
|
|
|
square root
|
|
|
square root of integer type. Equals floor(sqrt(x)) |
|
|
Constant Infinity (Inf) (double precision).
|
|
|
Constant Not a Number (NaN) (doble precision).
|
|
|
Constant Pi (double precision).
|