Orfeo Toolbox  4.0
itk::Math Namespace Reference

## Namespaces

namespace  Detail

## Functions

template<typename TReturn , typename TInput >
TReturn CastWithRangeCheck (TInput x)

template<TReturn , typename TInput >
Ceil (TInput x)
Round towards plus infinity. More...

template<typename T >
bool FloatAlmostEqual (T x1, T x2, typename Detail::FloatIEEE< T >::IntType maxUlps=4, typename Detail::FloatIEEE< T >::FloatType maxAbsoluteDifference=0.1 *NumericTraits< T >::epsilon())
Compare two floats and return if they are effectively equal. More...

template<typename T >
Detail::FloatIEEE< T >::IntType FloatDifferenceULP (T x1, T x2)
Return the signed distance in ULPs (units in the last place) between two floats. More...

template<TReturn , typename TInput >
Floor (TInput x)
Round towards minus infinity. More...

template<typename TReturn , typename TInput >
TReturn Round (TInput x)
Round towards nearest integer (This is a synonym for RoundHalfIntegerUp) More...

template<TReturn , typename TInput >
RoundHalfIntegerToEven (TInput x)
Round towards nearest integer. More...

template<TReturn , typename TInput >
RoundHalfIntegerUp (TInput x)
Round towards nearest integer. More...

## Variables

static const double e = 2.7182818284590452354

The base of the natural logarithm or Euler's number More...

static const double ln10 = 2.30258509299404568402

More...

static const double ln2 = 0.69314718055994530942

More...

static const double log10e = 0.43429448190325182765

More...

static const double log2e = 1.4426950408889634074

More...

static const double one_over_pi = 0.31830988618379067154

More...

static const double one_over_sqrt2pi = 0.39894228040143267794

More...

static const double pi = 3.14159265358979323846

More...

static const double pi_over_2 = 1.57079632679489661923

More...

static const double pi_over_4 = 0.78539816339744830962

More...

static const double sqrt1_2 = 0.70710678118654752440

More...

static const double sqrt2 = 1.41421356237309504880

More...

static const double two_over_pi = 0.63661977236758134308

More...

static const double two_over_sqrtpi = 1.12837916709551257390

More...

## Function Documentation

template<typename TReturn , typename TInput >
 TReturn itk::Math::CastWithRangeCheck ( TInput x )
inline

This class requires OnlyDefinedForIntegerTypes1 in the form of ( itk::Concept::IsInteger< TReturn > )

This class requires OnlyDefinedForIntegerTypes2 in the form of ( itk::Concept::IsInteger< TInput > )

Definition at line 179 of file itkMath.h.

References itk::NumericTraits< T >::IsPositive(), and itkConceptMacro.

template<TReturn , typename TInput >
 itk::Math::Ceil ( TInput x )

Round towards plus infinity.

The behavior of overflow is undefined due to numerous implementations.

Warning
argument absolute value must be less than INT_MAX/2 for vnl_math_ceil to be guaranteed to work.
We also assume that the rounding mode is not changed from the default one (or at least that it is always restored to the default one).
template<typename T >
 bool itk::Math::FloatAlmostEqual ( T x1, T x2, typename Detail::FloatIEEE< T >::IntType maxUlps = 4, typename Detail::FloatIEEE< T >::FloatType maxAbsoluteDifference = 0.1*NumericTraits::epsilon() )
inline

Compare two floats and return if they are effectively equal.

Determining when floats are almost equal is difficult because of their IEEE bit representation. This function uses the integer representation of the float to determine if they are almost equal.

The implementation is based off the explanation in the white papers:

This function is not a cure-all, and reading those articles is important to understand its appropriate use in the context of ULPs, zeros, subnormals, infinities, and NANs. For example, it is preferable to use this function on two floats directly instead of subtracting them and comparing them to zero.

The tolerance is specified in ULPs (units in the last place), i.e. how many floats there are in between the numbers. Therefore, the tolerance depends on the magnitude of the values that are being compared. A second tolerance is a maximum difference allowed, which is important when comparing numbers close to zero.

A NAN compares as not equal to a number, but two NAN's may compare as equal to each other.

Parameters
 x1 first floating value to compare x2 second floating values to compare maxUlps maximum units in the last place to be considered equal maxAbsoluteDifference maximum absolute difference to be considered equal

Definition at line 258 of file itkMath.h.

References FloatDifferenceULP().

Referenced by itk::PolyLineParametricPath< VDimension >::Evaluate().

template<typename T >
 Detail::FloatIEEE::IntType itk::Math::FloatDifferenceULP ( T x1, T x2 )
inline

Return the signed distance in ULPs (units in the last place) between two floats.

This is the signed distance, i.e., if x1 > x2, then the result is positive.

FloatAlmostEqual

Definition at line 219 of file itkMath.h.

References itk::Math::Detail::FloatIEEE< T >::AsULP().

Referenced by FloatAlmostEqual().

template<TReturn , typename TInput >
 itk::Math::Floor ( TInput x )

Round towards minus infinity.

The behavior of overflow is undefined due to numerous implementations.

Warning
argument absolute value must be less than NumbericTraits<TReturn>::max()/2 for vnl_math_floor to be guaranteed to work.
We also assume that the rounding mode is not changed from the default one (or at least that it is always restored to the default one).
template<typename TReturn , typename TInput >
 TReturn itk::Math::Round ( TInput x )
inline

Round towards nearest integer (This is a synonym for RoundHalfIntegerUp)

Template Parameters
 TReturn must be an integer type TInput must be float or double
RoundHalfIntegerUp<TReturn, TInput>()

Definition at line 148 of file itkMath.h.

template<TReturn , typename TInput >
 itk::Math::RoundHalfIntegerToEven ( TInput x )

Round towards nearest integer.

Template Parameters
 TReturn must be an integer type TInput must be float or double  halfway cases are rounded towards the nearest even integer, e.g.  RoundHalfIntegerToEven( 1.5) == 2 RoundHalfIntegerToEven(-1.5) == -2 RoundHalfIntegerToEven( 2.5) == 2 RoundHalfIntegerToEven( 3.5) == 4

The behavior of overflow is undefined due to numerous implementations.

Warning
We assume that the rounding mode is not changed from the default one (or at least that it is always restored to the default one).
template<TReturn , typename TInput >
 itk::Math::RoundHalfIntegerUp ( TInput x )

Round towards nearest integer.

Template Parameters
 TReturn must be an integer type TInput must be float or double  halfway cases are rounded upward, e.g.  RoundHalfIntegerUp( 1.5) == 2 RoundHalfIntegerUp(-1.5) == -1 RoundHalfIntegerUp( 2.5) == 3

The behavior of overflow is undefined due to numerous implementations.

Warning
The argument absolute value must be less than NumbericTraits<TReturn>::max()/2 for RoundHalfIntegerUp to be guaranteed to work.
We also assume that the rounding mode is not changed from the default one (or at least that it is always restored to the default one).

## Variable Documentation

 const double itk::Math::ln10 = 2.30258509299404568402
static

Definition at line 53 of file itkMath.h.

 const double itk::Math::ln2 = 0.69314718055994530942
static

Definition at line 51 of file itkMath.h.

 const double itk::Math::log10e = 0.43429448190325182765
static

Definition at line 49 of file itkMath.h.

 const double itk::Math::log2e = 1.4426950408889634074
static

Definition at line 47 of file itkMath.h.

 const double itk::Math::one_over_pi = 0.31830988618379067154
static

Definition at line 61 of file itkMath.h.

 const double itk::Math::one_over_sqrt2pi = 0.39894228040143267794
static

Definition at line 67 of file itkMath.h.

Referenced by itk::Statistics::GaussianDistribution::PDF().

 const double itk::Math::pi_over_2 = 1.57079632679489661923
static

Definition at line 57 of file itkMath.h.

 const double itk::Math::pi_over_4 = 0.78539816339744830962
static

Definition at line 59 of file itkMath.h.

 const double itk::Math::sqrt1_2 = 0.70710678118654752440
static

Definition at line 71 of file itkMath.h.

 const double itk::Math::sqrt2 = 1.41421356237309504880
static
 const double itk::Math::two_over_pi = 0.63661977236758134308
static

Definition at line 63 of file itkMath.h.

 const double itk::Math::two_over_sqrtpi = 1.12837916709551257390
static

Definition at line 65 of file itkMath.h.

Generated at Sat Mar 8 2014 18:02:25 for Orfeo Toolbox with doxygen 1.8.3.1