Classes | Defines | Functions
core/vnl/vnl_math.h File Reference

Namespace with standard math functions. More...

#include <vcl_cmath.h>
#include "dll.h"
#include <vxl_config.h>
#include <vnl/vnl_config.h>

Go to the source code of this file.

Classes

class  vnl_math
 real numerical constants. More...

Defines

#define GCC_USE_FAST_IMPL   0
#define VC_USE_FAST_IMPL   0

Functions

template<class T >
vnl_huge_val (T)
 Type-accessible infinities for use in templates.
double vnl_huge_val (double)
float vnl_huge_val (float)
long int vnl_huge_val (long int)
int vnl_huge_val (int)
short vnl_huge_val (short)
char vnl_huge_val (char)
bool vnl_math_isnan (char)
bool vnl_math_isnan (short)
bool vnl_math_isnan (int)
bool vnl_math_isnan (long)
bool vnl_math_isnan (signed char)
bool vnl_math_isnan (unsigned char)
bool vnl_math_isnan (float)
bool vnl_math_isnan (double)
bool vnl_math_isnan (long double)
template<class T >
bool vnl_math_isnan (T)
bool vnl_math_isinf (char)
bool vnl_math_isinf (short)
bool vnl_math_isinf (int)
bool vnl_math_isinf (long)
bool vnl_math_isinf (signed char)
bool vnl_math_isinf (unsigned char)
bool vnl_math_isinf (float)
bool vnl_math_isinf (double)
bool vnl_math_isinf (long double)
template<class T >
bool vnl_math_isinf (T)
bool vnl_math_isfinite (char)
bool vnl_math_isfinite (short)
bool vnl_math_isfinite (int)
bool vnl_math_isfinite (long)
bool vnl_math_isfinite (signed char)
bool vnl_math_isfinite (unsigned char)
bool vnl_math_isfinite (float)
bool vnl_math_isfinite (double)
bool vnl_math_isfinite (long double)
template<class T >
bool vnl_math_isfinite (T)
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)
float vnl_math_abs (float x)
double vnl_math_abs (double x)
long double vnl_math_abs (long double x)
int vnl_math_max (int x, int y)
unsigned int vnl_math_max (unsigned int x, unsigned int y)
long vnl_math_max (long x, long y)
unsigned long vnl_math_max (unsigned long x, unsigned long y)
float vnl_math_max (float x, float y)
double vnl_math_max (double x, double y)
int vnl_math_min (int x, int y)
unsigned int vnl_math_min (unsigned int x, unsigned int y)
long vnl_math_min (long x, long y)
unsigned long vnl_math_min (unsigned long x, unsigned long y)
float vnl_math_min (float x, float y)
double vnl_math_min (double x, double y)
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)
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)
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 (float x)
int vnl_math_sgn (double x)
int vnl_math_sgn0 (int x)
int vnl_math_sgn0 (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)
float vnl_math_squared_magnitude (float x)
double vnl_math_squared_magnitude (double x)
long double vnl_math_squared_magnitude (long double x)
float vnl_math_cuberoot (float a)
double vnl_math_cuberoot (double a)
double vnl_math_hypot (int x, int y)
float vnl_math_hypot (float x, float y)
double vnl_math_hypot (double x, double y)
long double vnl_math_hypot (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 class 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.
   

Definition in file vnl_math.h.


Define Documentation

#define GCC_USE_FAST_IMPL   0

Definition at line 59 of file vnl_math.h.

#define VC_USE_FAST_IMPL   0

Definition at line 65 of file vnl_math.h.


Function Documentation

template<class T >
T vnl_huge_val ( )

Type-accessible infinities for use in templates.

double vnl_huge_val ( double  )

Definition at line 287 of file vnl_math.cxx.

float vnl_huge_val ( float  )

Definition at line 288 of file vnl_math.cxx.

long int vnl_huge_val ( long  int)
int vnl_huge_val ( int  )

Definition at line 310 of file vnl_math.cxx.

short vnl_huge_val ( short  )

Definition at line 312 of file vnl_math.cxx.

char vnl_huge_val ( char  )

Definition at line 313 of file vnl_math.cxx.

bool vnl_math_abs ( bool  x) [inline]

Definition at line 534 of file vnl_math.h.

unsigned char vnl_math_abs ( unsigned char  x) [inline]

Definition at line 535 of file vnl_math.h.

unsigned char vnl_math_abs ( signed char  x) [inline]

Definition at line 536 of file vnl_math.h.

unsigned char vnl_math_abs ( char  x) [inline]

Definition at line 537 of file vnl_math.h.

unsigned short vnl_math_abs ( short  x) [inline]

Definition at line 538 of file vnl_math.h.

unsigned short vnl_math_abs ( unsigned short  x) [inline]

Definition at line 539 of file vnl_math.h.

unsigned int vnl_math_abs ( int  x) [inline]

Definition at line 540 of file vnl_math.h.

unsigned int vnl_math_abs ( unsigned int  x) [inline]

Definition at line 541 of file vnl_math.h.

unsigned long vnl_math_abs ( long  x) [inline]

Definition at line 542 of file vnl_math.h.

unsigned long vnl_math_abs ( unsigned long  x) [inline]

Definition at line 543 of file vnl_math.h.

float vnl_math_abs ( float  x) [inline]

Definition at line 548 of file vnl_math.h.

double vnl_math_abs ( double  x) [inline]

Definition at line 549 of file vnl_math.h.

long double vnl_math_abs ( long double  x) [inline]

Definition at line 550 of file vnl_math.h.

int vnl_math_ceil ( float  x) [inline]

Definition at line 520 of file vnl_math.h.

int vnl_math_ceil ( double  x) [inline]

Definition at line 524 of file vnl_math.h.

bool vnl_math_cube ( bool  x) [inline]

Definition at line 590 of file vnl_math.h.

int vnl_math_cube ( int  x) [inline]

Definition at line 591 of file vnl_math.h.

unsigned int vnl_math_cube ( unsigned int  x) [inline]

Definition at line 592 of file vnl_math.h.

long vnl_math_cube ( long  x) [inline]

Definition at line 593 of file vnl_math.h.

unsigned long vnl_math_cube ( unsigned long  x) [inline]

Definition at line 594 of file vnl_math.h.

float vnl_math_cube ( float  x) [inline]

Definition at line 599 of file vnl_math.h.

double vnl_math_cube ( double  x) [inline]

Definition at line 600 of file vnl_math.h.

float vnl_math_cuberoot ( float  a) [inline]

Definition at line 636 of file vnl_math.h.

double vnl_math_cuberoot ( double  a) [inline]

Definition at line 637 of file vnl_math.h.

int vnl_math_floor ( float  x) [inline]

Definition at line 435 of file vnl_math.h.

int vnl_math_floor ( double  x) [inline]

Definition at line 439 of file vnl_math.h.

double vnl_math_hypot ( int  x,
int  y 
) [inline]

Definition at line 640 of file vnl_math.h.

float vnl_math_hypot ( float  x,
float  y 
) [inline]

Definition at line 641 of file vnl_math.h.

double vnl_math_hypot ( double  x,
double  y 
) [inline]

Definition at line 642 of file vnl_math.h.

long double vnl_math_hypot ( long double  x,
long double  y 
) [inline]

Definition at line 643 of file vnl_math.h.

bool vnl_math_isfinite ( char  ) [inline]

Definition at line 172 of file vnl_math.h.

bool vnl_math_isfinite ( short  ) [inline]

Definition at line 173 of file vnl_math.h.

bool vnl_math_isfinite ( int  ) [inline]

Definition at line 174 of file vnl_math.h.

bool vnl_math_isfinite ( long  ) [inline]

Definition at line 175 of file vnl_math.h.

bool vnl_math_isfinite ( signed  char) [inline]

Definition at line 176 of file vnl_math.h.

bool vnl_math_isfinite ( unsigned  char) [inline]

Definition at line 177 of file vnl_math.h.

bool vnl_math_isfinite ( float  )

Definition at line 238 of file vnl_math.cxx.

bool vnl_math_isfinite ( double  )

Definition at line 239 of file vnl_math.cxx.

bool vnl_math_isfinite ( long  double)

Definition at line 240 of file vnl_math.cxx.

template<class T >
bool vnl_math_isfinite ( )
bool vnl_math_isinf ( char  ) [inline]

Definition at line 151 of file vnl_math.h.

bool vnl_math_isinf ( short  ) [inline]

Definition at line 152 of file vnl_math.h.

bool vnl_math_isinf ( int  ) [inline]

Definition at line 153 of file vnl_math.h.

bool vnl_math_isinf ( long  ) [inline]

Definition at line 154 of file vnl_math.h.

bool vnl_math_isinf ( signed  char) [inline]

Definition at line 155 of file vnl_math.h.

bool vnl_math_isinf ( unsigned  char) [inline]

Definition at line 156 of file vnl_math.h.

bool vnl_math_isinf ( float  )

Definition at line 272 of file vnl_math.cxx.

bool vnl_math_isinf ( double  )

Definition at line 273 of file vnl_math.cxx.

bool vnl_math_isinf ( long  double)

Definition at line 274 of file vnl_math.cxx.

template<class T >
bool vnl_math_isinf ( )
bool vnl_math_isnan ( char  ) [inline]

Definition at line 127 of file vnl_math.h.

bool vnl_math_isnan ( short  ) [inline]

Definition at line 128 of file vnl_math.h.

bool vnl_math_isnan ( int  ) [inline]

Definition at line 129 of file vnl_math.h.

bool vnl_math_isnan ( long  ) [inline]

Definition at line 130 of file vnl_math.h.

bool vnl_math_isnan ( signed  char) [inline]

Definition at line 131 of file vnl_math.h.

bool vnl_math_isnan ( unsigned  char) [inline]

Definition at line 132 of file vnl_math.h.

bool vnl_math_isnan ( float  )

Definition at line 180 of file vnl_math.cxx.

bool vnl_math_isnan ( double  )

Definition at line 181 of file vnl_math.cxx.

bool vnl_math_isnan ( long  double)

Definition at line 182 of file vnl_math.cxx.

template<class T >
bool vnl_math_isnan ( )
int vnl_math_max ( int  x,
int  y 
) [inline]

Definition at line 553 of file vnl_math.h.

unsigned int vnl_math_max ( unsigned int  x,
unsigned int  y 
) [inline]

Definition at line 554 of file vnl_math.h.

long vnl_math_max ( long  x,
long  y 
) [inline]

Definition at line 555 of file vnl_math.h.

unsigned long vnl_math_max ( unsigned long  x,
unsigned long  y 
) [inline]

Definition at line 556 of file vnl_math.h.

float vnl_math_max ( float  x,
float  y 
) [inline]

Definition at line 561 of file vnl_math.h.

double vnl_math_max ( double  x,
double  y 
) [inline]

Definition at line 562 of file vnl_math.h.

int vnl_math_min ( int  x,
int  y 
) [inline]

Definition at line 565 of file vnl_math.h.

unsigned int vnl_math_min ( unsigned int  x,
unsigned int  y 
) [inline]

Definition at line 566 of file vnl_math.h.

long vnl_math_min ( long  x,
long  y 
) [inline]

Definition at line 567 of file vnl_math.h.

unsigned long vnl_math_min ( unsigned long  x,
unsigned long  y 
) [inline]

Definition at line 568 of file vnl_math.h.

float vnl_math_min ( float  x,
float  y 
) [inline]

Definition at line 573 of file vnl_math.h.

double vnl_math_min ( double  x,
double  y 
) [inline]

Definition at line 574 of file vnl_math.h.

int vnl_math_rnd ( float  x) [inline]

Definition at line 355 of file vnl_math.h.

int vnl_math_rnd ( double  x) [inline]

Definition at line 356 of file vnl_math.h.

int vnl_math_rnd_halfinttoeven ( float  x) [inline]

Definition at line 265 of file vnl_math.h.

int vnl_math_rnd_halfinttoeven ( double  x) [inline]

Definition at line 282 of file vnl_math.h.

int vnl_math_rnd_halfintup ( float  x) [inline]

Definition at line 322 of file vnl_math.h.

int vnl_math_rnd_halfintup ( double  x) [inline]

Definition at line 327 of file vnl_math.h.

int vnl_math_sgn ( int  x) [inline]

Definition at line 603 of file vnl_math.h.

int vnl_math_sgn ( long  x) [inline]

Definition at line 604 of file vnl_math.h.

int vnl_math_sgn ( float  x) [inline]

Definition at line 608 of file vnl_math.h.

int vnl_math_sgn ( double  x) [inline]

Definition at line 609 of file vnl_math.h.

int vnl_math_sgn0 ( int  x) [inline]

Definition at line 612 of file vnl_math.h.

int vnl_math_sgn0 ( long  x) [inline]

Definition at line 613 of file vnl_math.h.

int vnl_math_sgn0 ( float  x) [inline]

Definition at line 617 of file vnl_math.h.

int vnl_math_sgn0 ( double  x) [inline]

Definition at line 618 of file vnl_math.h.

bool vnl_math_sqr ( bool  x) [inline]

Definition at line 577 of file vnl_math.h.

int vnl_math_sqr ( int  x) [inline]

Definition at line 578 of file vnl_math.h.

unsigned int vnl_math_sqr ( unsigned int  x) [inline]

Definition at line 579 of file vnl_math.h.

long vnl_math_sqr ( long  x) [inline]

Definition at line 580 of file vnl_math.h.

unsigned long vnl_math_sqr ( unsigned long  x) [inline]

Definition at line 581 of file vnl_math.h.

float vnl_math_sqr ( float  x) [inline]

Definition at line 586 of file vnl_math.h.

double vnl_math_sqr ( double  x) [inline]

Definition at line 587 of file vnl_math.h.

unsigned int vnl_math_squared_magnitude ( char  x) [inline]

Definition at line 621 of file vnl_math.h.

unsigned int vnl_math_squared_magnitude ( unsigned char  x) [inline]

Definition at line 622 of file vnl_math.h.

unsigned int vnl_math_squared_magnitude ( int  x) [inline]

Definition at line 623 of file vnl_math.h.

unsigned int vnl_math_squared_magnitude ( unsigned int  x) [inline]

Definition at line 624 of file vnl_math.h.

unsigned long vnl_math_squared_magnitude ( long  x) [inline]

Definition at line 625 of file vnl_math.h.

unsigned long vnl_math_squared_magnitude ( unsigned long  x) [inline]

Definition at line 626 of file vnl_math.h.

float vnl_math_squared_magnitude ( float  x) [inline]

Definition at line 631 of file vnl_math.h.

double vnl_math_squared_magnitude ( double  x) [inline]

Definition at line 632 of file vnl_math.h.

long double vnl_math_squared_magnitude ( long double  x) [inline]

Definition at line 633 of file vnl_math.h.