Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

NUM Namespace Reference

Numerics code is in the NUN namespace. More...


Classes

struct  FPConst
 Floating point constant template class. More...

class  NoiseGenerator_Base
 Noise generator base class. More...

class  NoiseGenerator_Perlin
 Ken Perlin's famous noise function. More...

class  OMatrix
 3x4 object transform matrix class. More...

class  Plane3
 3dim plane class template for types flt and dbl. More...

class  PolyRootSolver
 Base class for all polynomial root solvers. More...

class  PolyRootSolver_Bairstow
 Polynomial root solver based on the Bairstow method. More...

struct  PolyRootSolver_Bairstow::Params
 Tuning parameters:. More...

class  PolyRootSolver_Direct
 Direct polynomial root solver based on explicit formulas. More...

struct  PolyRootSolver_Direct::Params
 Tuning parameters:. More...

class  PolyRootSolver_Sturm
 Polynomial root solver based on the Sturm series of polynoms. More...

struct  PolyRootSolver_Sturm::Params
 Tuning parameters:. More...

struct  PolyRootSolver_Sturm::poly
 Structure for representing a polynomial. More...

class  RandomNumberGenerator
 Random number generator class for the end user. More...

class  RandomNumberGenerator_Base
 Random number generator base class. More...

class  RandomNumberGenerator_LibCRandom
 Interface to standard libc random() PRNG. More...

class  RandomNumberGenerator_MersenneTwister19937
 Fast Mersenne Twister pseudorandom number generator with period 2^19937-1. More...

class  Vector2
 2dim vector class template for types flt and dbl. More...

class  Vector3
 3dim vector class template for types flt and dbl. More...


Functions

template<typename T> Vector2< T > operator+ (const Vector2< T > &a, const Vector2< T > &b)
 Add 2 vectors:.

template<typename T> Vector2< T > operator- (const Vector2< T > &a, const Vector2< T > &b)
 Subract 2 vectors:.

template<typename T> Vector2< T > operator * (const Vector2< T > &a, T b)
 Multiply vector with scalar:.

template<typename T> Vector2< T > operator * (T b, const Vector2< T > &a)
template<typename T> Vector2< T > operator/ (const Vector2< T > &a, T b)
template<typename T> T len2 (const Vector2< T > &v)
 Compute square of length (Euclidic norm) of a vector:.

template<typename T> T len (const Vector2< T > &v)
 Compute length of a vector (Euclidic norm):.

template<typename T> T dist2 (const Vector2< T > &a, const Vector2< T > &b)
 Compute (Euclidic) squared distance between two points.

template<typename T> T dist (const Vector2< T > &a, const Vector2< T > &b)
 Compute (Euclidic) distance between two points.

template<typename T> Vector2< T > normalize (const Vector2< T > &v)
 Return a normalized vector (length 1):.

template<typename T> Vector2< T > normalize (const Vector2< T > &v, T l)
 Return a normalized vector with length l:.

template<typename T> T dot (const Vector2< T > &a, const Vector2< T > &b)
 Compute the scalar (dot) product of two vectors.

template<typename T> T angle (const Vector2< T > &a, const Vector2< T > &b)
 Compute angle between 2 vectors:.

template<typename T> bool equal (const Vector2< T > &a, const Vector2< T > &b, T epsilon)
template<typename T> Vector2< T > LinComb (const Vector2< T > &va, T ca, const Vector2< T > &vb)
 Compute linear combination va*ca + vb.

template<typename T> Vector2< T > LinComb (const Vector2< T > &va, T ca, const Vector2< T > &vb, T cb)
 Compute linear combination va+ca + vb*cb.

template<typename T> Vector2< T > LinComb (const Vector2< T > &va, T ca, const Vector2< T > &vb, T cb, const Vector2< T > &vc)
 Compute linear combination va+ca + vb*cb + vc.

template<typename T> Vector2< T > LinComb (const Vector2< T > &va, T ca, const Vector2< T > &vb, T cb, const Vector2< T > &vc, T cc)
 Compute linear combination va+ca + vb*cb + vc*cc.

template<typename T> Vector2< T > average (const Vector2< T > &a, const Vector2< T > &b)
 Compute the average (arithmetic) of two vectors, i.e. (a+b)/2.

void _OMatrixInstantiationDummy ()
template<typename T> OMatrix< T > operator+ (const OMatrix< T > &a, const OMatrix< T > &b)
 Add 2 matrices:.

template<typename T> OMatrix< T > operator- (const OMatrix< T > &a, const OMatrix< T > &b)
 Subract 2 matrices:.

template<typename T> OMatrix< T > operator * (const OMatrix< T > &a, T b)
 Multiply matrix with scalar:.

template<typename T> OMatrix< T > operator * (T b, const OMatrix< T > &a)
 Multiply matrix with scalar:.

template<typename T> OMatrix< T > operator * (const OMatrix< T > &a, const OMatrix< T > &b)
 Multiply matrix with matrix:.

template<typename T> OMatrix< T > operator/ (const OMatrix< T > &a, T b)
template<typename T> Vector3< T > operator * (const OMatrix< T > &a, const Vector3< T > &b)
 Multiply matrix with vector.

template<typename T> bool equal (const OMatrix< T > &a, const OMatrix< T > &b, T epsilon)
template<typename T> OMatrix< T > inverse (const OMatrix< T > &a)
 Invert matrix.

template<typename T> OMatrix< T > transpose (const OMatrix< T > &a)
 Transpose matrix (see transpose() member function!).

template<typename T, typename V> int IntersectTriangle (const Vector3< T > &orig, const Vector3< T > &dir, const Vector3< V > &vert0, const Vector3< V > &vert1, const Vector3< V > &vert2, T *t, T *u, T *v)
 Intersection of triangle with ray.

template<typename T> Vector3< T > operator+ (const Vector3< T > &a, const Vector3< T > &b)
 Add 2 vectors:.

template<typename T> Vector3< T > operator- (const Vector3< T > &a, const Vector3< T > &b)
 Subract 2 vectors:.

template<typename T> Vector3< T > operator * (const Vector3< T > &a, T b)
 Multiply vector with scalar:.

template<typename T> Vector3< T > operator * (T b, const Vector3< T > &a)
template<typename T> Vector3< T > operator/ (const Vector3< T > &a, T b)
template<typename T> T len2 (const Vector3< T > &v)
 Compute square of length (Euclidic norm) of a vector:.

template<typename T> T len (const Vector3< T > &v)
 Compute length of a vector (Euclidic norm):.

template<typename T> T dist2 (const Vector3< T > &a, const Vector3< T > &b)
 Compute (Euclidic) squared distance between two points.

template<typename T> T dist (const Vector3< T > &a, const Vector3< T > &b)
 Compute (Euclidic) distance between two points.

template<typename T> Vector3< T > normalize (const Vector3< T > &v)
 Return a normalized vector (length 1):.

template<typename T> Vector3< T > normalize (const Vector3< T > &v, T l)
 Return a normalized vector with length l:.

template<typename T> T dot (const Vector3< T > &a, const Vector3< T > &b)
 Compute the scalar (dot) product of two vectors.

template<typename T> Vector3< T > cross (const Vector3< T > &a, const Vector3< T > &b)
 Compute the vector (cross) product of two vectors.

template<typename T> T angle (const Vector3< T > &a, const Vector3< T > &b)
 Compute angle between 2 vectors:.

template<typename T> bool equal (const Vector3< T > &a, const Vector3< T > &b, T epsilon)
template<typename T> Vector3< T > LinComb (const Vector3< T > &va, T ca, const Vector3< T > &vb)
 Compute linear combination va*ca + vb.

template<typename T> Vector3< T > LinComb (const Vector3< T > &va, T ca, const Vector3< T > &vb, T cb)
 Compute linear combination va+ca + vb*cb.

template<typename T> Vector3< T > LinComb (const Vector3< T > &va, T ca, const Vector3< T > &vb, T cb, const Vector3< T > &vc)
 Compute linear combination va+ca + vb*cb + vc.

template<typename T> Vector3< T > LinComb (const Vector3< T > &va, T ca, const Vector3< T > &vb, T cb, const Vector3< T > &vc, T cc)
 Compute linear combination va+ca + vb*cb + vc*cc.

template<typename T> Vector3< T > average (const Vector3< T > &a, const Vector3< T > &b)
 Compute the average (arithmetic) of two vectors, i.e. (a+b)/2.

template<class T, class U> T cosinterp (U x, T v0, T v1)
 linear cosine interpolation

template<class T, class U> T cubinterp (U x, T v0, T v1, T v2, T v3)
 cubic interpolation

template<class T> T step (const T a, const T b)
 step function

template<class T> T pulse (const T x, const T a, const T b)
 the pulse function

template<class T> T bias (T b, T x)
 bias function

template<class T> T sbias (T b, T x)
 schlick's optimized bias function

template<class T> T gain (T g, T x)
 gain function

template<class T> T sgain (T g, T x)
 schlick's optimized gain function

template<typename T> volatile void _CME_add1 (T x, volatile T *res)
template<typename T> volatile T _ComputeMachEps1 ()
template<typename T> T _ComputeMachEps1_Prec ()
void _NoiseGenerator_PerlinInstantiationDummy ()
template<typename T> _constfn_ int sgn (T x)
 Return sign, i.e. -1, 0 or 1.

template<typename T> _constfn_ int sgn11 (T x)
 Return sign -1 or +1 with 0 being positive.

template<typename T> _constfn_ bool is_negative (T x)
_constfn_ bool is_negative (double x)
_constfn_ bool is_negative (float x)
_constfn_ bool is_negative (long double x)
template<typename T> _constfn_ T sqr (T x)
 Returns x*x.

template<typename T> T fabs (T x)
template<typename T> T max (T a, T b)
 Return the larger one of the two passed values. FP specialisation below.

template<typename T> T min (T a, T b)
 Return the smaller one of the two passed values. FP specialisation below.

 NUM_OVERLOADED (sqrt) NUM_OVERLOADED2(pow) NUM_OVERLOADED(sin) NUM_OVERLOADED(asin) NUM_OVERLOADED(cos) NUM_OVERLOADED(acos) NUM_OVERLOADED(sinh) NUM_OVERLOADED(asinh) NUM_OVERLOADED(cosh) NUM_OVERLOADED(acosh) NUM_OVERLOADED(tan) NUM_OVERLOADED(atan) NUM_OVERLOADED2(atan2) NUM_OVERLOADED(tanh) NUM_OVERLOADED(atanh) NUM_OVERLOADED(exp) NUM_OVERLOADED(log) NUM_OVERLOADED(ceil) NUM_OVERLOADED(floor) extern _deprecated_ dbl fmax(dbl x
_deprecated_ flt fmaxf (flt x, flt y)
_deprecated_ dbl fmin (dbl x, dbl y)
_deprecated_ flt fminf (flt x, flt y)
_deprecated_ dbl rint (dbl x)
_deprecated_ dbl nearbyint (dbl x)
_deprecated_ dbl round (dbl x)
template<typename I, typename FP> I iroundc (FP x)
template<> int32 iroundc< int32, double > (double x)
template<> int32 iroundc< int32, float > (float x)
template<> int32 iroundc< int32, long double > (long double x)
template<> int64 iroundc< int64, double > (double x)
template<> int64 iroundc< int64, float > (float x)
template<> int64 iroundc< int64, long double > (long double x)
 IROUND_OVERLOADED (iroundc, int8)
 IROUND_OVERLOADED (iroundc, uint8)
 IROUND_OVERLOADED (iroundc, int16)
 IROUND_OVERLOADED (iroundc, uint16)
template<typename I, typename FP> I iroundc (I *d, FP x)
template<typename I, typename FP> I iround (FP x)
template<> int32 iround< int32, double > (double x)
template<> int32 iround< int32, float > (float x)
template<> int32 iround< int32, long double > (long double x)
template<> int64 iround< int64, double > (double x)
template<> int64 iround< int64, float > (float x)
template<> int64 iround< int64, long double > (long double x)
template<typename I, typename FP> I iround (I *d, FP x)
template<typename T> T cbrt (T x)
template<typename T> T exp10 (T x)
template<typename T> T log10 (T x)
template<typename T> T exp2 (T x)
template<typename T> T log2 (T x)
_deprecated_ dbl logb (dbl x)
_deprecated_ flt logbf (flt x)
template<typename T> int ilog2 (T x)
_deprecated_ int ilogb (dbl x)
_deprecated_ int ilogbf (flt x)
template<typename T> T expm1 (T x)
template<typename T> T log1p (T x)
template<typename T> T copysign (T x, T y)
template<typename T> T fdim (T x, T y)
template<typename T> T fma (T x, T y, T z)
template<typename T> void sincos (T x, T *sinx, T *cosx)
double ldexp (double x, int exp)
float ldexp (float x, int exp)
long double ldexp (long double x, int exp)
_deprecated_ dbl scalbn (dbl x, int exp)
_deprecated_ dbl scalb (dbl x, int exp)
double modf (double x, double *iptr)
float modf (float x, float *iptr)
long double modf (long double x, long double *iptr)
double frexp (double x, int *exp)
float frexp (float x, int *exp)
long double frexp (long double x, int *exp)
_deprecated_ dbl drem (dbl x, dbl y)
_deprecated_ flt drem (flt x, flt y)
_deprecated_ flt dremf (flt x, flt y)
template<typename T> T dabs (T x, T y)
 Return absolute value of difference.

_deprecated_ int signbit (dbl x)
_deprecated_ int isinf (dbl x)
_deprecated_ int isnan (dbl x)
_deprecated_ int finite (dbl x)
_deprecated_ int isfinite (dbl x)
_deprecated_ int fpclassify (dbl x)
_deprecated_ dbl significand (dbl x)
template<typename T> T max (T a, T b, T c)
 Return the largest one of the 3 passed values.

template<typename T> T min (T a, T b, T c)
 Return the smallest one of the 3 passed values.

_constfn_ int powii (int x, int y)
 x^y in integer arithmetic. y MUST BE >=0.

template<typename T> _constfn_ T powi (T x, int y)
 x^y for FP x and integer y.

template<typename T> _constfn_ T clamp2 (T x, T low, T high)
 Clamp value x between low and high.

template<typename T> T clamp1 (T x, T b)
 Clamp value x between -b and b:.

template<typename T> T hypot2 (T a, T b)
 Numerically stable version of hypot().

template<typename T, typename P> T lerp2 (T l, T r, P p, P p1)
 Linear interpolation.

template<typename T, typename P> T lerp (T l, T r, P p)
 Linear interpolation.

template<typename T, typename P> T bilerp2 (T lt, T rt, T lb, T rb, P px, P py, P px1, P py1)
 Bi-linear interpolation.

template<typename T, typename P> T bilerp (T lt, T rt, T lb, T rb, P px, P py)
 Bi-linear interpolation.

template<typename T> T FermiDirac (T x)
 Compute Fermi-Dirac (smooth) step function.

template<typename T> T FermiDirac (T x, T t)
 Compute Fermi-Dirac (smooth) step function.

template<typename T> T StepLinear (T x, T a, T b)
 Linear interpolating step function.

template<typename T> T StepCubic (T x, T a, T b)
 Cubic interpolating step function.

template<typename T> T NormEuclidic2 (const T *x, int dim)
 Returns square of Euclidic norm of passed vector.

template<typename T> T NormEuclidic (const T *x, int dim)
 Returns Euclidic norm of passed vector.

template<typename T> T DistEuclidic2 (const T *x, const T *y, int dim)
 Returns the squared distance between two points (Euclidic norm):.

template<typename T> T DistEuclidic (const T *x, const T *y, int dim)
 Returns the distance between two points (Euclidic norm):.

template<typename T> T FindMaximum (const T *a, int dim)
 Return maximum entry, i.e. max{ a[0],...,a[dim-1] }.

template<class T> T FindMinimum (const T *a, int dim)
 Find minimum entry, i.e. min{ a[0],...,a[dim-1] }.

template<class T> int FindMinimumIdx (const T *a, int dim)
 Find index of smallest element.

template<typename T> T NormalizeVector (T *x, int dim)
 Normalize vector in-place, i.e. scale it to length 1:.

template<typename T> T NormalizeVector (T *dest, const T *src, int dim)
 Normalize vector, i.e. scale it to length 1:.

template<typename T> T NormalizeVector2D (T *x)
 Special version to normalize a 2D vector.

template<typename T> void CrossProduct (T *dest, const T *a, const T *b)
 Calculate cross product res=a x b. All vectors are 3dim, of course.

template<typename T> T DotProduct (const T *a, const T *b, int dim)
 Calculate dot product res=<a,b>.

template<typename T> T DotProduct3D (const T *a, const T *b)
 (Faster) 3D version of DotProduct().

template<typename T> T PolvEval (T x, const T *c, int n)
 Evaluate polynomial of degree n.

template<typename T> int ArrayBinsearchInterval (T *array, int size, T value)
 Perform binary search on a sorted (FP) array.

template<typename T> int TestOrderAscenting (const T *array, int n, T val_eps=1e-7)
 Check if the passed t values are increasing steadily.

char _StartupCheck ()

Variables

const FPConst< dblfpconst_dbl
 Global constant definition for dbl values.

const FPConst< fltfpconst_flt
 Global constant definition for flt values.

dbl y
char _startup_check = _StartupCheck()


Detailed Description

Numerics code is in the NUN namespace.

Todo:
(num_math) Go through the source and check where we can use potentially faster functions, especially is_negative(), fma().
Also, get rid of NAN and Inf and use FPConst<>::nan,... instead.
Furthermore, add the following functions from glibc and provide own implementation if unavailable: erf, erfc, lgamma_r, tgamma.
Go through the source and see if we want to do rounding instead of using int(x+0.5).
Things still missing: int feclearexcept(int excepts); int fegetexceptflag(fexcept_t *flagp, int excepts); int feraiseexcept(int excepts); int fesetexceptflag(const fexcept_t *flagp, int excepts); int fetestexcept(int excepts); int fegetround(void); int fesetround(int rounding_mode); int fegetenv(fenv_t *envp); int feholdexcept(fenv_t *envp); int fesetenv(const fenv_t *envp); int feupdateenv(const fenv_t *envp);
As well as:
nextafter(), nexttoward(),..
HAVE a look at GCC's "other built-in functions": Also for bit-counting,


Function Documentation

template<typename T>
volatile void NUM::_CME_add1 x,
volatile T *  res
[static]
 

Definition at line 38 of file macheps.cc.

Referenced by _ComputeMachEps1().

template<typename T>
volatile T _ComputeMachEps1  )  [static]
 

Definition at line 25 of file macheps.cc.

References _CME_add1().

template<typename T>
T _ComputeMachEps1_Prec  )  [static]
 

Definition at line 44 of file macheps.cc.

void _NoiseGenerator_PerlinInstantiationDummy  ) 
 

Definition at line 223 of file perlin.cc.

References NUM::NoiseGenerator_Perlin< T >::noise1(), NUM::NoiseGenerator_Perlin< T >::noise2(), and NUM::NoiseGenerator_Perlin< T >::noise3().

void NUM::_OMatrixInstantiationDummy  ) 
 

Definition at line 25 of file omatrix.cc.

char _StartupCheck  )  [static]
 

Definition at line 30 of file libc.cc.

References CritAssert.

template<typename T>
T angle const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute angle between 2 vectors:.

Definition at line 325 of file vector3.h.

References dot(), and NUM::Vector3< T >::len2().

template<typename T>
T angle const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Compute angle between 2 vectors:.

Definition at line 198 of file vector2.h.

References dot(), and NUM::Vector2< T >::len2().

Referenced by NUM::OMatrix< T >::OMatrix().

template<typename T>
int ArrayBinsearchInterval T *  array,
int  size,
value
[inline]
 

Perform binary search on a sorted (FP) array.

array[0..size-1] is an array of elements sorted in ascenting order.
This function searches the index i with the following condition:
array[i] <= value < array[i+1],
i.e. the index of the interval which holds the value.

Returns:
-1, if value<array[0] and
size, if array[size-1]<=value
Returns 0 if size=0.
This function does a binary search and thus has log(size) runtime.

Definition at line 1326 of file num_math.h.

References Assert.

template<typename T>
Vector3<T> average const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute the average (arithmetic) of two vectors, i.e. (a+b)/2.

Definition at line 369 of file vector3.h.

template<typename T>
Vector2<T> average const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Compute the average (arithmetic) of two vectors, i.e. (a+b)/2.

Definition at line 233 of file vector2.h.

template<class T>
T bias b,
x
 

bias function

Parameters:
b shape parameter
x fctval

Definition at line 70 of file functions.h.

References log2().

template<typename T, typename P>
T bilerp lt,
rt,
lb,
rb,
px,
py
[inline]
 

Bi-linear interpolation.

There is another version available which is faster when 1-px,1-py is available or needed for several identical coordinates.

Please see the other version bilerp2() for more information about the parameters.

Definition at line 1050 of file num_math.h.

template<typename T, typename P>
T bilerp2 lt,
rt,
lb,
rb,
px,
py,
px1,
py1
[inline]
 

Bi-linear interpolation.

lt,rt,lb,rb define the left/top, right/top, left/bottom, right/bottom values, respectively; the bilinear interpolation will interpolate the value at the point px,py where px,py are in range 0..1.

The following values will be returned in followind special cases:
px=0, py=0 -> lt
px=1, py=0 -> rt
px=0, py=1 -> lb
px=1, py=1 -> rb
(Hence, the left/right/top/bottom is like screen coordinates, right bottom being "positive".)

px1,py1 must be set to 1-px and 1-py, respectively.

There is another version available which calculates px1,py1.

Definition at line 1036 of file num_math.h.

template<typename T>
T cbrt x  )  [inline]
 

Definition at line 381 of file num_math.h.

References is_negative().

Referenced by NUM::PolyRootSolver_Direct::Solve_3(), and NUM::PolyRootSolver_Direct::Solve_4().

template<typename T>
T clamp1 x,
b
[inline]
 

Clamp value x between -b and b:.

See also clamp().

Definition at line 970 of file num_math.h.

References fabs().

template<typename T>
_constfn_ T clamp2 x,
low,
high
[inline]
 

Clamp value x between low and high.

For symmetric border (ala -b..b), use clamp1() which is faster.
See also: clamp1().

Definition at line 962 of file num_math.h.

References _constfn_.

template<typename T>
T copysign x,
y
[inline]
 

Definition at line 450 of file num_math.h.

References is_negative(), and y.

template<class T, class U>
T cosinterp x,
v0,
v1
 

linear cosine interpolation

Parameters:
x weight
v(i) vertices
Returns:
interpolated value

Definition at line 29 of file functions.h.

template<typename T>
Vector3<T> cross const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute the vector (cross) product of two vectors.

Definition at line 317 of file vector3.h.

Referenced by IntersectTriangle().

template<typename T>
void CrossProduct T *  dest,
const T *  a,
const T *  b
[inline]
 

Calculate cross product res=a x b. All vectors are 3dim, of course.

Definition at line 1269 of file num_math.h.

template<class T, class U>
T cubinterp x,
v0,
v1,
v2,
v3
 

cubic interpolation

Parameters:
x weight
v(i) vertices
Returns:
interpolated value

Definition at line 40 of file functions.h.

template<typename T>
T dabs x,
y
[inline]
 

Return absolute value of difference.

Calculates fabs(x-y).

See also: fabs(), fdim(), signbit().

Definition at line 882 of file num_math.h.

References fabs(), and y.

template<typename T>
T dist const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute (Euclidic) distance between two points.

Definition at line 302 of file vector3.h.

References dist2().

template<typename T>
T dist const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Compute (Euclidic) distance between two points.

Definition at line 183 of file vector2.h.

template<typename T>
T dist2 const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute (Euclidic) squared distance between two points.

Definition at line 299 of file vector3.h.

References sqr().

template<typename T>
T dist2 const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Compute (Euclidic) squared distance between two points.

Definition at line 180 of file vector2.h.

References sqr().

Referenced by dist().

template<typename T>
T DistEuclidic const T *  x,
const T *  y,
int  dim
[inline]
 

Returns the distance between two points (Euclidic norm):.

Points x,y specified as arrays of size dim.

See also DistEuclidic2().

Definition at line 1170 of file num_math.h.

References fabs(), sqr(), and y.

template<typename T>
T DistEuclidic2 const T *  x,
const T *  y,
int  dim
[inline]
 

Returns the squared distance between two points (Euclidic norm):.

Points x,y specified as arrays of size dim.

See also DistEuclidic().

Definition at line 1156 of file num_math.h.

References sqr(), and y.

template<typename T>
T dot const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Compute the scalar (dot) product of two vectors.

Definition at line 313 of file vector3.h.

template<typename T>
T dot const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Compute the scalar (dot) product of two vectors.

Definition at line 194 of file vector2.h.

Referenced by angle(), NUM::Plane3< T >::compute(), NUM::Plane3< T >::distance(), and IntersectTriangle().

template<typename T>
T DotProduct const T *  a,
const T *  b,
int  dim
[inline]
 

Calculate dot product res=<a,b>.

Both vectors have the specified dimension dim.
See also: DotProduct3D() (faster for 3d).

Definition at line 1283 of file num_math.h.

template<typename T>
T DotProduct3D const T *  a,
const T *  b
[inline]
 

(Faster) 3D version of DotProduct().

Definition at line 1290 of file num_math.h.

_deprecated_ flt drem flt  x,
flt  y
 

_deprecated_ dbl drem dbl  x,
dbl  y
 

_deprecated_ flt dremf flt  x,
flt  y
 

template<typename T>
bool equal const Vector3< T > &  a,
const Vector3< T > &  b,
epsilon
[inline]
 

Compare two vectors using specified epsilon value:

See also:
Vector3::IsNull() member function to compare against zero.

Definition at line 330 of file vector3.h.

References fabs().

template<typename T>
bool equal const OMatrix< T > &  a,
const OMatrix< T > &  b,
epsilon
[inline]
 

Compare two matrices using specified epsilon value:

See also:
OMatrix::IsNull() member function to compare against zero.

Definition at line 373 of file omatrix.h.

References fabs().

template<typename T>
bool equal const Vector2< T > &  a,
const Vector2< T > &  b,
epsilon
[inline]
 

Compare two vectors using specified epsilon value:

See also:
Vector2::IsNull() member function to compare against zero.

Definition at line 203 of file vector2.h.

References fabs().

template<typename T>
T exp10 x  )  [inline]
 

Definition at line 390 of file num_math.h.

template<typename T>
T exp2 x  )  [inline]
 

Definition at line 404 of file num_math.h.

template<typename T>
T expm1 x  )  [inline]
 

Definition at line 436 of file num_math.h.

template<typename T>
T fabs x  )  [inline]
 

Definition at line 262 of file num_math.h.

Referenced by NUM::PolyRootSolver_Bairstow::_Deflate(), NUM::PolyRootSolver_Bairstow::_FindQuadFact(), NUM::PolyRootSolver_Bairstow::_QuadricRealRoots(), NUM::PolyRootSolver_Bairstow::_QuadricRoots(), NUM::PolyRootSolver_Bairstow::_Recurse(), NUM::PolyRootSolver_Sturm::buildsturm(), clamp1(), dabs(), DistEuclidic(), equal(), hypot2(), IntersectTriangle(), NUM::Vector3< T >::IsNull(), NUM::OMatrix< T >::IsNull(), NUM::Vector2< T >::IsNull(), NUM::PolyRootSolver_Sturm::modp(), NUM::PolyRootSolver_Sturm::modrf(), NUM::Vector3< T >::norm1(), NUM::Vector2< T >::norm1(), NormEuclidic(), NUM::PolyRootSolver_Sturm::sbisect(), NUM::PolyRootSolver_Bairstow::solve(), NUM::PolyRootSolver_Direct::Solve_2(), NUM::PolyRootSolver_Direct::Solve_3(), and NUM::PolyRootSolver_Direct::Solve_4().

template<typename T>
T fdim x,
y
[inline]
 

Definition at line 457 of file num_math.h.

References is_negative(), and y.

template<typename T>
T FermiDirac x,
t
[inline]
 

Compute Fermi-Dirac (smooth) step function.

The Fermi-Dirac function is defined as:
f(x,T) = 1/( 1 + exp(-x/T))

The values are in range 0..1 with 0.5 for x=0.
The parameter T ("temperature") controls the smoothness.

This function here uses t=1/T instead of T:

FermiDirac(x,t) = 1/( 1 + exp(-x*t))

For t=0, the function is infinitly smooth (0.5 everywhere) while for t=infinity it is like the Heavyside function.

There is another version which does not use t or T.

Definition at line 1085 of file num_math.h.

References FermiDirac().

template<typename T>
T FermiDirac x  )  [inline]
 

Compute Fermi-Dirac (smooth) step function.

FermiDirac(x) = 1/( 1 + exp(-x))

There is another version which provides a smoothness parameter t and an x-value; see there for more info.

Definition at line 1064 of file num_math.h.

Referenced by FermiDirac().

template<typename T>
T FindMaximum const T *  a,
int  dim
[inline]
 

Return maximum entry, i.e. max{ a[0],...,a[dim-1] }.

Returns 0 if dim=0.

See also FindMinimum(), max(), min().

Definition at line 1186 of file num_math.h.

References max().

template<class T>
T FindMinimum const T *  a,
int  dim
[inline]
 

Find minimum entry, i.e. min{ a[0],...,a[dim-1] }.

See also FindMaximum(), max(), min(), FindMinimumIdx().

Definition at line 1200 of file num_math.h.

References min().

template<class T>
int FindMinimumIdx const T *  a,
int  dim
[inline]
 

Find index of smallest element.

This is similar to FindMinimum() but returns the index instead of the value. Returns -1 of dim=0.

Definition at line 1216 of file num_math.h.

References min().

_deprecated_ int finite dbl  x  ) 
 

template<typename T>
T fma x,
y,
z
[inline]
 

Definition at line 467 of file num_math.h.

References y.

_deprecated_ flt fmaxf flt  x,
flt  y
 

_deprecated_ dbl fmin dbl  x,
dbl  y
 

_deprecated_ flt fminf flt  x,
flt  y
 

_deprecated_ int fpclassify dbl  x  ) 
 

long double frexp long double  x,
int *  exp
[inline]
 

Definition at line 509 of file num_math.h.

float frexp float  x,
int *  exp
[inline]
 

Definition at line 508 of file num_math.h.

double frexp double  x,
int *  exp
[inline]
 

Definition at line 507 of file num_math.h.

Referenced by _Float2String().

template<class T>
T gain g,
x
 

gain function

Parameters:
g shape parameter
x fctval

Definition at line 86 of file functions.h.

template<typename T>
T hypot2 a,
b
[inline]
 

Numerically stable version of hypot().

Don't know if it is really needed or if hypot() is clever enough.
Computes sqrt(a^2 + b^2) without destructive underflow or overflow (algorithm from Numerical Recipes).

Definition at line 980 of file num_math.h.

References fabs(), and sqr().

template<typename T>
int ilog2 x  )  [inline]
 

Definition at line 426 of file num_math.h.

_deprecated_ int ilogb dbl  x  ) 
 

_deprecated_ int ilogbf flt  x  ) 
 

template<typename T, typename V>
int IntersectTriangle const Vector3< T > &  orig,
const Vector3< T > &  dir,
const Vector3< V > &  vert0,
const Vector3< V > &  vert1,
const Vector3< V > &  vert2,
T *  t,
T *  u,
T *  v
 

Intersection of triangle with ray.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [ based heavily upon code by Tomas Möller <tompa@clarus.se> and Ben Trumbore <wbt@graphics.cornell.edu>, see below.
This implements the "Fast, Minimum Storage Ray-Triangle Intersection" by Abstract:

We present a clean algorithm for determining whether a ray intersects a triangle. The algorithm translates the origin of the ray and then changes the base to yield a vector (t u v)^T, where t is the distance to the plane in which the triangle lies and (u,v) represents the coordinates inside the triangle.

One advantage of this method is that the plane equation need not be computed on the fly nor be stored, which can amount to significant memory savings for triangle meshes. As we found our method to be comparable in speed to previous methods, we believe it is the fastest ray-triangle intersection routine for triangles that do not have precomputed plane equations.

Parameters:
orig ray start point in space
dir ray direction vector
vert0 first vertex vector of triangle
vert1 second vertex vector of triangle
vert2 third vertex vector of triangle
t returns the distance to the plane in which the triangle lies
u,v return the coordinates inside the triangle
Returns:
1 if the ray intersects, 0 otherwise

Todo:
What to do with this epsilon value...

Definition at line 45 of file triangle.cc.

References cross(), dot(), and fabs().

template<typename T>
OMatrix<T> inverse const OMatrix< T > &  a  )  [inline]
 

Invert matrix.

Definition at line 382 of file omatrix.h.

template<typename I, typename FP>
I iround I *  d,
FP  x
[inline]
 

Definition at line 374 of file num_math.h.

template<typename I, typename FP>
I iround FP  x  )  [inline]
 

template<>
int32 iround< int32, double > double  x  )  [inline]
 

template<>
int32 iround< int32, float > float  x  )  [inline]
 

template<>
int32 iround< int32, long double > long double  x  )  [inline]
 

template<>
int64 iround< int64, double > double  x  )  [inline]
 

template<>
int64 iround< int64, float > float  x  )  [inline]
 

template<>
int64 iround< int64, long double > long double  x  )  [inline]
 

NUM::IROUND_OVERLOADED iroundc  ,
uint16 
 

NUM::IROUND_OVERLOADED iroundc  ,
int16 
 

NUM::IROUND_OVERLOADED iroundc  ,
uint8 
 

NUM::IROUND_OVERLOADED iroundc  ,
int8 
 

template<typename I, typename FP>
I iroundc I *  d,
FP  x
[inline]
 

Definition at line 354 of file num_math.h.

template<typename I, typename FP>
I iroundc FP  x  )  [inline]
 

template<>
int32 iroundc< int32, double > double  x  )  [inline]
 

template<>
int32 iroundc< int32, float > float  x  )  [inline]
 

template<>
int32 iroundc< int32, long double > long double  x  )  [inline]
 

template<>
int64 iroundc< int64, double > double  x  )  [inline]
 

template<>
int64 iroundc< int64, float > float  x  )  [inline]
 

template<>
int64 iroundc< int64, long double > long double  x  )  [inline]
 

_constfn_ bool is_negative long double  x  )  [inline]
 

Definition at line 210 of file num_math.h.

References _constfn_, and signbit().

_constfn_ bool is_negative float  x  )  [inline]
 

Definition at line 208 of file num_math.h.

References _constfn_, and signbit().

_constfn_ bool is_negative double  x  )  [inline]
 

Definition at line 206 of file num_math.h.

References _constfn_, and signbit().

template<typename T>
_constfn_ bool is_negative x  )  [inline]
 

Definition at line 199 of file num_math.h.

References _constfn_.

Referenced by cbrt(), copysign(), and fdim().

_deprecated_ int isfinite dbl  x  ) 
 

_deprecated_ int isinf dbl  x  ) 
 

_deprecated_ int isnan dbl  x  ) 
 

long double ldexp long double  x,
int  exp
[inline]
 

Definition at line 490 of file num_math.h.

float ldexp float  x,
int  exp
[inline]
 

Definition at line 489 of file num_math.h.

double ldexp double  x,
int  exp
[inline]
 

Definition at line 488 of file num_math.h.

template<typename T>
T len const Vector3< T > &  v  )  [inline]
 

Compute length of a vector (Euclidic norm):.

Definition at line 295 of file vector3.h.

References len2().

template<typename T>
T len const Vector2< T > &  v  )  [inline]
 

Compute length of a vector (Euclidic norm):.

Definition at line 176 of file vector2.h.

Referenced by NUM::Plane3< T >::compute(), NormalizeVector(), and NormalizeVector2D().

template<typename T>
T len2 const Vector3< T > &  v  )  [inline]
 

Compute square of length (Euclidic norm) of a vector:.

Definition at line 292 of file vector3.h.

template<typename T>
T len2 const Vector2< T > &  v  )  [inline]
 

Compute square of length (Euclidic norm) of a vector:.

Definition at line 173 of file vector2.h.

Referenced by len().

template<typename T, typename P>
T lerp l,
r,
p
[inline]
 

Linear interpolation.

There is another version available which is faster when 1-p is available or needed for several identical coordinates.

Please see the other version lerp2() for more information about the parameters.

Definition at line 1013 of file num_math.h.

Referenced by NUM::NoiseGenerator_Perlin< T >::noise1(), NUM::NoiseGenerator_Perlin< T >::noise2(), and NUM::NoiseGenerator_Perlin< T >::noise3().

template<typename T, typename P>
T lerp2 l,
r,
p,
p1
[inline]
 

Linear interpolation.

l,r define the left, right values, respectively; the linear interpolation will interpolate the value at the point p where p is in range 0..1.

In case p=0, l will be returned, for p=1, r will be returned.

p1 must be set to 1-p.

There is another version available which calculates p1.

Definition at line 1001 of file num_math.h.

template<typename T>
Vector3<T> LinComb const Vector3< T > &  va,
ca,
const Vector3< T > &  vb,
cb,
const Vector3< T > &  vc,
cc
[inline]
 

Compute linear combination va+ca + vb*cb + vc*cc.

Definition at line 360 of file vector3.h.

template<typename T>
Vector3<T> LinComb const Vector3< T > &  va,
ca,
const Vector3< T > &  vb,
cb,
const Vector3< T > &  vc
[inline]
 

Compute linear combination va+ca + vb*cb + vc.

Definition at line 352 of file vector3.h.

template<typename T>
Vector3<T> LinComb const Vector3< T > &  va,
ca,
const Vector3< T > &  vb,
cb
[inline]
 

Compute linear combination va+ca + vb*cb.

Definition at line 344 of file vector3.h.

template<typename T>
Vector3<T> LinComb const Vector3< T > &  va,
ca,
const Vector3< T > &  vb
[inline]
 

Compute linear combination va*ca + vb.

Definition at line 336 of file vector3.h.

template<typename T>
Vector2<T> LinComb const Vector2< T > &  va,
ca,
const Vector2< T > &  vb,
cb,
const Vector2< T > &  vc,
cc
[inline]
 

Compute linear combination va+ca + vb*cb + vc*cc.

Definition at line 225 of file vector2.h.

template<typename T>
Vector2<T> LinComb const Vector2< T > &  va,
ca,
const Vector2< T > &  vb,
cb,
const Vector2< T > &  vc
[inline]
 

Compute linear combination va+ca + vb*cb + vc.

Definition at line 218 of file vector2.h.

template<typename T>
Vector2<T> LinComb const Vector2< T > &  va,
ca,
const Vector2< T > &  vb,
cb
[inline]
 

Compute linear combination va+ca + vb*cb.

Definition at line 213 of file vector2.h.

template<typename T>
Vector2<T> LinComb const Vector2< T > &  va,
ca,
const Vector2< T > &  vb
[inline]
 

Compute linear combination va*ca + vb.

Definition at line 208 of file vector2.h.

template<typename T>
T log10 x  )  [inline]
 

Definition at line 397 of file num_math.h.

template<typename T>
T log1p x  )  [inline]
 

Definition at line 443 of file num_math.h.

template<typename T>
T log2 x  )  [inline]
 

Definition at line 413 of file num_math.h.

Referenced by bias().

_deprecated_ dbl logb dbl  x  ) 
 

_deprecated_ flt logbf flt  x  ) 
 

template<typename T>
T max a,
b,
c
[inline]
 

Return the largest one of the 3 passed values.

Definition at line 923 of file num_math.h.

References max().

template<typename T>
T max a,
b
[inline]
 

Return the larger one of the two passed values. FP specialisation below.

Definition at line 268 of file num_math.h.

Referenced by FindMaximum(), max(), NUM::PolyRootSolver_Sturm::sbisect(), and NUM::PolyRootSolver_Sturm::solve().

template<typename T>
T min a,
b,
c
[inline]
 

Return the smallest one of the 3 passed values.

Definition at line 926 of file num_math.h.

References min().

template<typename T>
T min a,
b
[inline]
 

Return the smaller one of the two passed values. FP specialisation below.

Definition at line 271 of file num_math.h.

Referenced by FindMinimum(), FindMinimumIdx(), min(), NUM::PolyRootSolver_Sturm::sbisect(), and NUM::PolyRootSolver_Sturm::solve().

long double modf long double  x,
long double *  iptr
[inline]
 

Definition at line 502 of file num_math.h.

float modf float  x,
float *  iptr
[inline]
 

Definition at line 500 of file num_math.h.

double modf double  x,
double *  iptr
[inline]
 

Definition at line 498 of file num_math.h.

_deprecated_ dbl nearbyint dbl  x  ) 
 

template<typename T>
Vector3<T> normalize const Vector3< T > &  v,
l
[inline]
 

Return a normalized vector with length l:.

Definition at line 309 of file vector3.h.

References NUM::Vector3< T >::len().

template<typename T>
Vector3<T> normalize const Vector3< T > &  v  )  [inline]
 

Return a normalized vector (length 1):.

Definition at line 306 of file vector3.h.

References NUM::Vector3< T >::len().

template<typename T>
Vector2<T> normalize const Vector2< T > &  v,
l
[inline]
 

Return a normalized vector with length l:.

Definition at line 190 of file vector2.h.

References NUM::Vector2< T >::len().

template<typename T>
Vector2<T> normalize const Vector2< T > &  v  )  [inline]
 

Return a normalized vector (length 1):.

Definition at line 187 of file vector2.h.

References NUM::Vector2< T >::len().

template<typename T>
T NormalizeVector T *  dest,
const T *  src,
int  dim
[inline]
 

Normalize vector, i.e. scale it to length 1:.

Normalisation is done by copying the vector array src[] to dest[] while dividing the components by the length.

Returns:
Length of vector before normalisation. Can be used to check for zero length.

Definition at line 1256 of file num_math.h.

References len(), and NormEuclidic().

template<typename T>
T NormalizeVector T *  x,
int  dim
[inline]
 

Normalize vector in-place, i.e. scale it to length 1:.

The passed vector in array x[] of specified dimension is normalized thereby replacing the values in x[].

Returns:
Length of vector before normalisation. Can be used to check for zero length.
See also NormalizeVector2D().

Definition at line 1239 of file num_math.h.

References len(), and NormEuclidic().

template<typename T>
T NormalizeVector2D T *  x  )  [inline]
 

Special version to normalize a 2D vector.

Definition at line 1265 of file num_math.h.

References len().

template<typename T>
T NormEuclidic const T *  x,
int  dim
[inline]
 

Returns Euclidic norm of passed vector.

Passed vector has dimenstion dim. The function calculates the square root of the sum of the squared elements of x[], i.e. the (Euclidic) length of the vector.

See also: NormEuclidic2().

Definition at line 1141 of file num_math.h.

References fabs(), and sqr().

Referenced by NormalizeVector().

template<typename T>
T NormEuclidic2 const T *  x,
int  dim
[inline]
 

Returns square of Euclidic norm of passed vector.

Passed vector has dimenstion dim. The function calculates the the sum of the squared elements of x[], i.e. the squared (Euclidic) length of the vector.

See also: NormEuclidic().

Definition at line 1125 of file num_math.h.

References sqr().

NUM_OVERLOADED sqrt   ) 
 

template<typename T>
Vector3<T> operator * b,
const Vector3< T > &  a
[inline]
 

Definition at line 283 of file vector3.h.

template<typename T>
Vector3<T> operator * const Vector3< T > &  a,
b
[inline]
 

Multiply vector with scalar:.

Definition at line 281 of file vector3.h.

template<typename T>
Vector3<T> operator * const OMatrix< T > &  a,
const Vector3< T > &  b
[inline]
 

Multiply matrix with vector.

Definition at line 367 of file omatrix.h.

template<typename T>
OMatrix<T> operator * const OMatrix< T > &  a,
const OMatrix< T > &  b
[inline]
 

Multiply matrix with matrix:.

Definition at line 357 of file omatrix.h.

template<typename T>
OMatrix<T> operator * b,
const OMatrix< T > &  a
[inline]
 

Multiply matrix with scalar:.

Definition at line 353 of file omatrix.h.

template<typename T>
OMatrix<T> operator * const OMatrix< T > &  a,
b
[inline]
 

Multiply matrix with scalar:.

Definition at line 350 of file omatrix.h.

template<typename T>
Vector2<T> operator * b,
const Vector2< T > &  a
[inline]
 

Definition at line 164 of file vector2.h.

template<typename T>
Vector2<T> operator * const Vector2< T > &  a,
b
[inline]
 

Multiply vector with scalar:.

Definition at line 162 of file vector2.h.

template<typename T>
Vector3<T> operator+ const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Add 2 vectors:.

Definition at line 272 of file vector3.h.

template<typename T>
OMatrix<T> operator+ const OMatrix< T > &  a,
const OMatrix< T > &  b
[inline]
 

Add 2 matrices:.

Definition at line 334 of file omatrix.h.

template<typename T>
Vector2<T> operator+ const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Add 2 vectors:.

Definition at line 153 of file vector2.h.

template<typename T>
Vector3<T> operator- const Vector3< T > &  a,
const Vector3< T > &  b
[inline]
 

Subract 2 vectors:.

Definition at line 276 of file vector3.h.

template<typename T>
OMatrix<T> operator- const OMatrix< T > &  a,
const OMatrix< T > &  b
[inline]
 

Subract 2 matrices:.

Definition at line 345 of file omatrix.h.

template<typename T>
Vector2<T> operator- const Vector2< T > &  a,
const Vector2< T > &  b
[inline]
 

Subract 2 vectors:.

Definition at line 157 of file vector2.h.

template<typename T>
Vector3<T> operator/ const Vector3< T > &  a,
b
[inline]
 

Divide vector by scalar. Better do multiplication with 1/b.

Definition at line 288 of file vector3.h.

template<typename T>
OMatrix<T> operator/ const OMatrix< T > &  a,
b
[inline]
 

Divide matrix by scalar. Better do multiplication with 1/b.

Definition at line 363 of file omatrix.h.

template<typename T>
Vector2<T> operator/ const Vector2< T > &  a,
b
[inline]
 

Divide vector by scalar. Better do multiplication with 1/b.

Definition at line 169 of file vector2.h.

template<typename T>
T PolvEval x,
const T *  c,
int  n
[inline]
 

Evaluate polynomial of degree n.

I.e. compute
c[0] + c[1]*x + c[2]*x^2 + ... + c[n]*x^n
in an efficient way.

NOTE! Array c[] needs to be dimensioned c[n+1] since c[0]..c[n] are used.
Make sure n>=0 otherwise crash due to access c[-1],c[-2],...

Definition at line 1304 of file num_math.h.

Referenced by NUM::PolyRootSolver_Sturm::numchanges(), and NUM::PolyRootSolver_Sturm::sbisect().

template<typename T>
_constfn_ T powi x,
int  y
[inline]
 

x^y for FP x and integer y.

Definition at line 938 of file num_math.h.

References _constfn_, and y.

_constfn_ int powii int  x,
int  y
[inline]
 

x^y in integer arithmetic. y MUST BE >=0.

Definition at line 930 of file num_math.h.

References _constfn_, and y.

template<class T>
T pulse const T  x,
const T  a,
const T  b
 

the pulse function

Definition at line 62 of file functions.h.

References step().

_deprecated_ dbl rint dbl  x  ) 
 

_deprecated_ dbl round dbl  x  ) 
 

template<class T>
T sbias b,
x
 

schlick's optimized bias function

Parameters:
b shape parameter
x fctval

Definition at line 78 of file functions.h.

_deprecated_ dbl scalb dbl  x,
int  exp
 

_deprecated_ dbl scalbn dbl  x,
int  exp
 

template<class T>
T sgain g,
x
 

schlick's optimized gain function

Parameters:
g shape parameter
x fctval

Definition at line 96 of file functions.h.

template<typename T>
_constfn_ int sgn x  )  [inline]
 

Return sign, i.e. -1, 0 or 1.

This is a relatively slow function. Better use something else.
See also sgn11(), is_negative(), copysign().

Definition at line 180 of file num_math.h.

References _constfn_.

template<typename T>
_constfn_ int sgn11 x  )  [inline]
 

Return sign -1 or +1 with 0 being positive.

Use sgn11() if you want to treat 0 as positive or if the value x is known not to be 0.
Faster than sgn() but better use (faster) is_negative().
See also sgn(), is_negative(), copysign().

Definition at line 191 of file num_math.h.

References _constfn_.

_deprecated_ int signbit dbl  x  ) 
 

Referenced by is_negative().

_deprecated_ dbl significand dbl  x  ) 
 

template<typename T>
void sincos x,
T *  sinx,
T *  cosx
[inline]
 

Definition at line 482 of file num_math.h.

Referenced by NUM::OMatrix< T >::OMatrix().

template<typename T>
_constfn_ T sqr x  )  [inline]
 

Returns x*x.

Definition at line 255 of file num_math.h.

References _constfn_.

Referenced by NUM::NoiseGenerator_Perlin< T >::_init(), dist2(), DistEuclidic(), DistEuclidic2(), hypot2(), NormEuclidic(), NormEuclidic2(), NUM::OMatrix< T >::OMatrix(), NUM::PolyRootSolver_Direct::Solve_2(), NUM::PolyRootSolver_Direct::Solve_3(), and NUM::PolyRootSolver_Direct::Solve_4().

template<class T>
T step const T  a,
const T  b
 

step function

Definition at line 56 of file functions.h.

Referenced by pulse().

template<typename T>
T StepCubic x,
a,
b
[inline]
 

Cubic interpolating step function.

Author:
Klaus Sausen (nicolasius § users.sourceforge.net), Wolfgang Wieser ] wwieser (a) gmx <*> de [
This function is 0 for x<a and 1 for x>b and does cubic interpolation in between.

Todo:
faster version for symmetric borders?

Definition at line 1112 of file num_math.h.

References StepLinear().

template<typename T>
T StepLinear x,
a,
b
[inline]
 

Linear interpolating step function.

Author:
Klaus Sausen (nicolasius § users.sourceforge.net), Wolfgang Wieser ] wwieser (a) gmx <*> de [
This function is 0 for x<a and 1 for x>b and does linear interpolation in between.

Todo:
faster version for symmetric borders?

Definition at line 1099 of file num_math.h.

Referenced by StepCubic().

template<typename T>
int TestOrderAscenting const T *  array,
int  n,
val_eps = 1e-7
[inline]
 

Check if the passed t values are increasing steadily.

Actually, it checks if array[i]-array[i-1] <= val_eps.

Returns:
0 -> OK
>0 -> index of the array element which is smaller than its predecessor.
Returns 0 if array==NULL.

Definition at line 1357 of file num_math.h.

template<typename T>
OMatrix<T> transpose const OMatrix< T > &  a  )  [inline]
 

Transpose matrix (see transpose() member function!).

Definition at line 386 of file omatrix.h.


Variable Documentation

char NUM::_startup_check = _StartupCheck() [static]
 

Definition at line 36 of file libc.cc.

const FPConst< dbl > NUM::fpconst_dbl
 

Initial value:

{
    INIT_FIELD(macheps1) _ComputeMachEps1<dbl>(),
    INIT_FIELD(sqrt_macheps1) sqrt(_ComputeMachEps1<dbl>()),
    INIT_FIELD(macheps1_prec) _ComputeMachEps1_Prec<dbl>()
}
Global constant definition for dbl values.

Definition at line 55 of file macheps.cc.

const FPConst< flt > NUM::fpconst_flt
 

Initial value:

{
    INIT_FIELD(macheps1) _ComputeMachEps1<flt>(),
    INIT_FIELD(sqrt_macheps1) sqrt(_ComputeMachEps1<flt>()),
    INIT_FIELD(macheps1_prec) _ComputeMachEps1_Prec<flt>()
}
Global constant definition for flt values.

Definition at line 62 of file macheps.cc.

dbl NUM::y
 

Definition at line 316 of file num_math.h.

Referenced by NUM::RandomNumberGenerator_MersenneTwister19937::_rand32(), copysign(), dabs(), DistEuclidic(), DistEuclidic2(), fdim(), fma(), NUM::NoiseGenerator_Base< T >::noise2(), NUM::NoiseGenerator_Base< T >::noise3(), powi(), powii(), NUM::Vector2< T >::Vector2(), and NUM::Vector3< T >::Vector3().


Generated on Sat Feb 19 22:35:55 2005 for Ray by doxygen 1.3.5