Namespaces | Macros | Functions
vnl_math.h File Reference

Namespace with standard math functions. More...

#include <cmath>
#include <algorithm>
#include <complex>
#include "dll.h"
#include <vxl_config.h>
#include <vnl/vnl_config.h>
#include <vnl/vnl_export.h>

Go to the source code of this file.

Namespaces

 vnl_math
 real numerical constants.
 

Macros

#define USE_SSE2_IMPL   0
 
#define GCC_USE_FAST_IMPL   0
 
#define VC_USE_FAST_IMPL   0
 

Functions

template<class T >
VNL_EXPORT T vnl_huge_val (T)
 Type-accessible infinities for use in templates. More...
 
VNL_EXPORT long double vnl_huge_val (long double)
 
VNL_EXPORT double vnl_huge_val (double)
 
VNL_EXPORT float vnl_huge_val (float)
 
VNL_EXPORT long int vnl_huge_val (long int)
 
VNL_EXPORT int vnl_huge_val (int)
 
VNL_EXPORT short vnl_huge_val (short)
 
VNL_EXPORT char vnl_huge_val (char)
 
double vnl_math::angle_0_to_2pi (double angle)
 Convert an angle to [0, 2Pi) range. More...
 
double vnl_math::angle_minuspi_to_pi (double angle)
 Convert an angle to [-Pi, Pi) range. More...
 
template<typename TArg >
bool vnl_math::isinf (TArg arg)
 
template<typename TArg >
bool vnl_math::isnan (TArg arg)
 
template<typename TArg >
bool vnl_math::isfinite (TArg arg)
 
template<typename TArg >
bool vnl_math::isnormal (TArg arg)
 
int vnl_math::rnd_halfinttoeven (float x)
 
int vnl_math::rnd_halfinttoeven (double x)
 
int vnl_math::rnd_halfintup (float x)
 
int vnl_math::rnd_halfintup (double x)
 
int vnl_math::rnd (float x)
 
int vnl_math::rnd (double x)
 
int vnl_math::floor (float x)
 
int vnl_math::floor (double x)
 
int vnl_math::ceil (float x)
 
int vnl_math::ceil (double x)
 
bool vnl_math::abs (bool x)
 
unsigned char vnl_math::abs (unsigned char x)
 
unsigned char vnl_math::abs (signed char x)
 
unsigned char vnl_math::abs (char x)
 
unsigned short vnl_math::abs (short x)
 
unsigned short vnl_math::abs (unsigned short x)
 
unsigned int vnl_math::abs (int x)
 
unsigned int vnl_math::abs (unsigned int x)
 
unsigned long vnl_math::abs (long x)
 
unsigned long vnl_math::abs (unsigned long x)
 
unsigned long long vnl_math::abs (long long x)
 
unsigned long long vnl_math::abs (unsigned long long x)
 
float vnl_math::abs (float x)
 
double vnl_math::abs (double x)
 
long double vnl_math::abs (long double x)
 
bool vnl_math::sqr (bool x)
 
int vnl_math::sqr (int x)
 
unsigned int vnl_math::sqr (unsigned int x)
 
long vnl_math::sqr (long x)
 
unsigned long vnl_math::sqr (unsigned long x)
 
long long vnl_math::sqr (long long x)
 
unsigned long long vnl_math::sqr (unsigned long long x)
 
float vnl_math::sqr (float x)
 
double vnl_math::sqr (double x)
 
bool vnl_math::cube (bool x)
 
int vnl_math::cube (int x)
 
unsigned int vnl_math::cube (unsigned int x)
 
long vnl_math::cube (long x)
 
unsigned long vnl_math::cube (unsigned long x)
 
long long vnl_math::cube (long long x)
 
unsigned long long vnl_math::cube (unsigned long long x)
 
float vnl_math::cube (float x)
 
double vnl_math::cube (double x)
 
int vnl_math::sgn (int x)
 
int vnl_math::sgn (long x)
 
int vnl_math::sgn (long long x)
 
int vnl_math::sgn (float x)
 
int vnl_math::sgn (double x)
 
int vnl_math::sgn0 (int x)
 
int vnl_math::sgn0 (long x)
 
int vnl_math::sgn0 (long long x)
 
int vnl_math::sgn0 (float x)
 
int vnl_math::sgn0 (double x)
 
unsigned int vnl_math::squared_magnitude (char x)
 
unsigned int vnl_math::squared_magnitude (unsigned char x)
 
unsigned int vnl_math::squared_magnitude (int x)
 
unsigned int vnl_math::squared_magnitude (unsigned int x)
 
unsigned long vnl_math::squared_magnitude (long x)
 
unsigned long vnl_math::squared_magnitude (unsigned long x)
 
unsigned long long vnl_math::squared_magnitude (long long x)
 
unsigned long long vnl_math::squared_magnitude (unsigned long long x)
 
float vnl_math::squared_magnitude (float x)
 
double vnl_math::squared_magnitude (double x)
 
long double vnl_math::squared_magnitude (long double x)
 
int vnl_math::remainder_truncated (int x, int y)
 
unsigned int vnl_math::remainder_truncated (unsigned int x, unsigned int y)
 
long vnl_math::remainder_truncated (long x, long y)
 
unsigned long vnl_math::remainder_truncated (unsigned long x, unsigned long y)
 
long long vnl_math::remainder_truncated (long long x, long long y)
 
unsigned long long vnl_math::remainder_truncated (unsigned long long x, unsigned long long y)
 
float vnl_math::remainder_truncated (float x, float y)
 
double vnl_math::remainder_truncated (double x, double y)
 
long double vnl_math::remainder_truncated (long double x, long double y)
 
int vnl_math::remainder_floored (int x, int y)
 
unsigned int vnl_math::remainder_floored (unsigned int x, unsigned int y)
 
long vnl_math::remainder_floored (long x, long y)
 
unsigned long vnl_math::remainder_floored (unsigned long x, unsigned long y)
 
long long vnl_math::remainder_floored (long long x, long long y)
 
unsigned long long vnl_math::remainder_floored (unsigned long long x, unsigned long long y)
 
float vnl_math::remainder_floored (float x, float y)
 
double vnl_math::remainder_floored (double x, double y)
 
long double vnl_math::remainder_floored (long double x, long double y)
 

Detailed Description

Namespace with standard math functions.

The vnl_math namespace provides a standard set of the simple mathematical functions (min, max, sqr, sgn, rnd, abs), and some predefined constants such as pi and e, which are not defined by the ANSI C++ standard.

There are complex versions defined in vnl_complex.h

That's right, M_PI is nonstandard!

Aside from e, pi and their associates the namespace also defines eps, the IEEE double machine precision. This is the smallest number eps such that 1+eps != 1.

The operations are overloaded for int, float and double arguments, which in combination with inlining can make them more efficient than their counterparts in the standard C library.

Author
Andrew W. Fitzgibbon, Oxford RRG
Date
July 13, 1996
  Modifications
   21 May 1998 AWF Removed conditional VCL_IMPLEMENT_STATIC_CONSTS, sometimes gcc needs them.
   LSB (Modifications) 23 Jan 2001 Documentation tidied
   Peter Vanroose - 7 Sep 2002 - maxdouble etc. replaced by vnl_numeric_traits<T>::maxval
   Amitha Perera - 13 Sep 2002 - make constant initialization standards compliant.
   Peter Vanroose -22 Oct 2012 - was a class, now is a namespace
                                 also renamed functions vnl_math_isnan etc. to vnl_math::isnan

Definition in file vnl_math.h.

Macro Definition Documentation

◆ GCC_USE_FAST_IMPL

#define GCC_USE_FAST_IMPL   0

Definition at line 67 of file vnl_math.h.

◆ USE_SSE2_IMPL

#define USE_SSE2_IMPL   0

Definition at line 60 of file vnl_math.h.

◆ VC_USE_FAST_IMPL

#define VC_USE_FAST_IMPL   0

Definition at line 73 of file vnl_math.h.

Function Documentation

◆ vnl_huge_val() [1/8]

template<class T >
VNL_EXPORT T vnl_huge_val ( )

Type-accessible infinities for use in templates.

◆ vnl_huge_val() [2/8]

VNL_EXPORT long double vnl_huge_val ( long double  )

Definition at line 14 of file vnl_math.cxx.

◆ vnl_huge_val() [3/8]

VNL_EXPORT double vnl_huge_val ( double  )

Definition at line 13 of file vnl_math.cxx.

◆ vnl_huge_val() [4/8]

VNL_EXPORT float vnl_huge_val ( float  )

Definition at line 12 of file vnl_math.cxx.

◆ vnl_huge_val() [5/8]

VNL_EXPORT long int vnl_huge_val ( long int  )

◆ vnl_huge_val() [6/8]

VNL_EXPORT int vnl_huge_val ( int  )

Definition at line 20 of file vnl_math.cxx.

◆ vnl_huge_val() [7/8]

VNL_EXPORT short vnl_huge_val ( short  )

Definition at line 22 of file vnl_math.cxx.

◆ vnl_huge_val() [8/8]

VNL_EXPORT char vnl_huge_val ( char  )

Definition at line 23 of file vnl_math.cxx.