Common Mathematical Functions

Functions

template<typename T >
BALL::Maths::abs (const T &t)
template<typename T >
BALL::Maths::frac (const T &t)
template<typename T >
BALL::Maths::max (const T &a, const T &b)
template<typename T >
BALL::Maths::max (const T &a, const T &b, const T &ct)
template<typename T >
BALL::Maths::min (const T &a, const T &b)
template<typename T >
BALL::Maths::min (const T &a, const T &b, const T &ct)
template<typename T >
BALL::Maths::round (const T &t)
template<typename T >
BALL::Maths::sgn (const T &t)
template<typename T >
bool BALL::Maths::isFinite (const T &t)
template<typename T >
bool BALL::Maths::isNan (const T &t)
template<typename T >
bool BALL::Maths::isInfinite (const T &t)
template<typename T >
bool BALL::Maths::isZero (const T &t)
template<typename T >
bool BALL::Maths::isNotZero (const T &t)
template<typename T1 , typename T2 >
bool BALL::Maths::isEqual (const T1 &a, const T2 &b)
template<typename T1 , typename T2 >
bool BALL::Maths::isNotEqual (const T1 &a, const T2 &b)
template<typename T1 , typename T2 >
bool BALL::Maths::isLess (const T1 &a, const T2 &b)
template<typename T1 , typename T2 >
bool BALL::Maths::isLessOrEqual (const T1 &a, const T2 &b)
template<typename T1 , typename T2 >
bool BALL::Maths::isGreaterOrEqual (const T1 &a, const T2 &b)
template<typename T1 , typename T2 >
bool BALL::Maths::isGreater (const T1 &a, const T2 &b)
template<typename T >
long BALL::Maths::floor (const T &t)
template<typename T >
long BALL::Maths::ceiling (const T &t)
template<typename T1 , typename T2 >
Index BALL::Maths::compare (const T1 &a, const T2 &b)
template<typename T >
bool BALL::Maths::isNear (const T &a, const T &b, const T &max_diff)
double BALL::Maths::rint (double x)
 round to integral value in floating-point format

Detailed Description

Namespace: BALL::Maths


Function Documentation

template<typename T >
T BALL::Maths::abs ( const T &  t  )  [inline]

Return the absolute value of a number.

Parameters:
t the number
Returns:
T the absolute value

Definition at line 54 of file MATHS/common.h.

template<typename T >
long BALL::Maths::ceiling ( const T &  t  )  [inline]

Return the ceiling of a number.

Parameters:
t the number
Returns:
T the ceiling

Definition at line 300 of file MATHS/common.h.

template<typename T1 , typename T2 >
Index BALL::Maths::compare ( const T1 &  a,
const T2 &  b 
) [inline]

Compare two numbers to each other.

Parameters:
a the first number
b the second number
Returns:
Index -1 a < b; 0 a = b; 1 a > b

Definition at line 312 of file MATHS/common.h.

template<typename T >
long BALL::Maths::floor ( const T &  t  )  [inline]

Return the floor of a number.

Parameters:
t the number
Returns:
T the floor

Definition at line 289 of file MATHS/common.h.

template<typename T >
T BALL::Maths::frac ( const T &  t  )  [inline]

Return the fraction of a number.

Parameters:
t the number
Returns:
T the fraction

Definition at line 65 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isEqual ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is equal to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if the absolute distance of a and b is below Constants::EPSILON

Definition at line 217 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isFinite ( const T &  t  )  [inline]

Test whether a number is finite.

Parameters:
t the number
Returns:
bool, true if t is finite

Definition at line 153 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isGreater ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is greater compared to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if a is greater than b

Definition at line 278 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isGreaterOrEqual ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is greater or equal compared to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if a is greater or equal than b

Definition at line 266 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isInfinite ( const T &  t  )  [inline]

Test whether a number is infinite.

Parameters:
t the number
Returns:
bool, true if t equals inf or -inf

Definition at line 183 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isLess ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is less compared to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if a is smaller than b

Definition at line 241 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isLessOrEqual ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is less or equal compared to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if a is less or equal b

Definition at line 254 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNan ( const T &  t  )  [inline]

Test whether a value is not a number.

Parameters:
t the number
Returns:
bool, true if t equals nan

Definition at line 168 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNear ( const T &  a,
const T &  b,
const T &  max_diff 
) [inline]

Test whether two numbers are close to each other.

Parameters:
a the first number
b the second number
max_diff the maximum allowed difference between the two numbers
Returns:
bool, true if the absolute distance between a and b is below max_diff

Definition at line 325 of file MATHS/common.h.

template<typename T1 , typename T2 >
bool BALL::Maths::isNotEqual ( const T1 &  a,
const T2 &  b 
) [inline]

Test whether a number is not equal to another.

Parameters:
a the first number
b the second number
Returns:
bool, true if the absolute distance of a and b is at least Constants::EPSILON

Definition at line 229 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isNotZero ( const T &  t  )  [inline]

Test whether a number is not zero.

Parameters:
t the number
Returns:
bool, true, if the absolute value of t is at least Constants::EPSILON

Definition at line 205 of file MATHS/common.h.

template<typename T >
bool BALL::Maths::isZero ( const T &  t  )  [inline]

Test whether a number is zero.

Parameters:
t the number
Returns:
bool, true if the absolute value of t is below Constants::EPSILON

Definition at line 194 of file MATHS/common.h.

template<typename T >
T BALL::Maths::max ( const T &  a,
const T &  b,
const T &  ct 
) [inline]

Return the greatest of three numbers.

Parameters:
a the first number
b the second number
ct the third number
Returns:
T the greatest number

Definition at line 92 of file MATHS/common.h.

template<typename T >
T BALL::Maths::max ( const T &  a,
const T &  b 
) [inline]

Return the greater of two numbers.

Parameters:
a the first number
b the second number
Returns:
T the greatest number

Definition at line 79 of file MATHS/common.h.

template<typename T >
T BALL::Maths::min ( const T &  a,
const T &  b,
const T &  ct 
) [inline]

Return the smallest of three numbers.

Parameters:
a the first number
b the second number
ct the third number
Returns:
T the smallest number

Definition at line 119 of file MATHS/common.h.

template<typename T >
T BALL::Maths::min ( const T &  a,
const T &  b 
) [inline]

Return the smallest of two numbers.

Parameters:
a the first number
b the second number
Returns:
T the smallest number

Definition at line 106 of file MATHS/common.h.

double BALL::Maths::rint ( double  x  )  [inline]

round to integral value in floating-point format

Definition at line 332 of file MATHS/common.h.

template<typename T >
T BALL::Maths::round ( const T &  t  )  [inline]

Round a number and return the result.

Parameters:
t the number
Returns:
T the result

Definition at line 131 of file MATHS/common.h.

template<typename T >
T BALL::Maths::sgn ( const T &  t  )  [inline]

Return the sign of a number.

Parameters:
t the number
Returns:
Index -1 t < 0; 0 t = 0; 1 t > 0

Definition at line 142 of file MATHS/common.h.

Generated by  doxygen 1.6.3