Allolib  1.0
C++ Components For Interactive Multimedia
Math

Classes

class  al::MinMeanMax< T >
 
class  al::Polar< T >
 
class  al::Complex< T >
 
class  al::Frustum< T >
 Rectangular frustum. More...
 
class  al::Interval< T >
 A closed interval [min, max]. More...
 
class  al::Mat< N, T >
 Fixed-size n-by-n square matrix. More...
 
class  al::Matrix4< T >
 
class  al::Plane< T >
 
class  al::Quat< T >
 
class  al::rnd::Random< RNG >
 
class  al::Ray< T >
 
class  al::SphereCoord< T >
 Spherical coordinate in terms of two complex numbers. More...
 
class  al::SphericalHarmonic< L_MAX >
 Spherical harmonic evaluator using cached coefficients. More...
 
class  al::Vec< N, T >
 Fixed-size n-vector. More...
 

Functions

template<class VecN , class T >
void al::rotatePlane (VecN &v1, VecN &v2, const Complex< T > &a)
 
template<class Vec3 , class T >
Vec3 al::sterProj (const al::Complex< T > &c)
 
bool al::aeq (float a, float b, int maxULP=10)
 Return whether two floats are almost equal. More...
 
template<class T >
al::ampTodB (const T &amp)
 
template<class T >
al::atLeast (const T &v, const T &eps)
 
template<class T >
al::atan2Fast (const T &y, const T &x)
 
uint32_t al::bitsSet (uint32_t v)
 Returns number of bits set to 1. More...
 
template<class T >
al::ceil (const T &val, const T &step)
 
uint32_t al::ceilPow2 (uint32_t value)
 Returns power of two ceiling of value. More...
 
template<class T >
al::clip (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
al::clip (const T &v, int &clipFlag, const T &hi, const T &lo)
 Returns value clipped to [lo, hi] and signifies clipping behavior. More...
 
template<class T >
al::clipS (const T &value, const T &hi=T(1))
 
template<class T >
al::dBToAmp (const T &db)
 
template<class T >
bool al::even (const T &v)
 
template<class T >
al::erf (const T &v)
 
uint32_t al::factorial (uint32_t n0to12)
 
double al::factorialSqrt (int v)
 
template<class T >
al::floor (const T &val, const T &step)
 
uint32_t al::floorPow2 (uint32_t value)
 Returns power of two floor of value. More...
 
template<class T >
al::fold (const T &value, const T &hi=T(1), const T &lo=T(0))
 Returns value folded into [lo, hi]. More...
 
template<class T >
al::foldOnce (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
al::gaussian (const T &v)
 
template<class T >
al::gcd (const T &x, const T &y)
 
template<class T >
al::gudermannian (const T &x)
 
template<class T >
al::laguerreL (int n, int k, T x)
 Generalized Laguerre polynomial L{n,k}. More...
 
template<class T >
al::legendreP (int l, int m, T t)
 
template<class T >
bool al::lessAbs (const T &v, const T &eps=T(0.000001))
 
template<typename T >
al::max (const T &v1, const T &v2, const T &v3)
 
template<class T >
al::mean (const T &v1, const T &v2)
 
template<class T >
al::min (const T &v1, const T &v2, const T &v3)
 
template<class T >
al::nearestDiv (T of, T to)
 
template<class T >
al::nextAfter (const T &x, const T &y)
 
template<class T >
al::nextMultiple (T val, T multiple)
 
template<class T >
al::numInt (const T &v)
 
template<class T >
bool al::odd (const T &v)
 
template<class T >
al::poly (const T &x, const T &a0, const T &a1, const T &a2)
 
template<class T >
al::poly (const T &x, const T &a0, const T &a1, const T &a2, const T &a3)
 
template<class T >
al::powN (T base, unsigned power)
 Returns value to a positive integer power. More...
 
unsigned char al::prime (uint32_t n)
 
template<class T >
al::round (const T &v, const T &step)
 
template<class T >
al::round (const T &v, const T &step, const T &recStep)
 
template<class T >
al::roundAway (const T &v)
 
template<class T >
al::roundAway (const T &v, const T &step)
 
template<class T >
al::sgn (const T &v, const T &norm=T(1))
 
template<class T >
al::sinc (const T &radians, const T &eps=T(0.0001))
 
template<class T >
al::slope (const T &x1, const T &y1, const T &x2, const T &y2)
 
template<class T >
void al::sort (T &value1, T &value2)
 
template<class T >
al::sumOfSquares (T n)
 
uint32_t al::trailingZeroes (uint32_t v)
 Returns number of trailing zeros in 32-bit int. More...
 
template<class T >
al::trunc (const T &v, const T &step)
 
template<class T >
al::trunc (const T &v, const T &step, const T &recStep)
 
template<class T >
bool al::within (const T &v, const T &lo, const T &hi)
 
template<class T >
bool al::within3 (const T &v1, const T &v2, const T &v3, const T &lo, const T &hi)
 
template<class T >
bool al::withinIE (const T &v, const T &lo, const T &hi)
 
template<class T >
al::wrap (const T &value, const T &hi=T(1), const T &lo=T(0))
 
template<class T >
al::wrap (const T &value, long &numWraps, const T &hi=T(1), const T &lo=T(0))
 Returns value wrapped in [lo, hi). More...
 
template<class T >
al::wrapAdd1 (const T &v, const T &max)
 
template<class T >
al::wrapOnce (const T &value, const T &hi=T(1))
 
template<class T >
al::wrapPhase (const T &radians)
 
template<class T >
al::wrapPhaseOnce (const T &radians)
 
template<class Tf , class Tv >
Tv al::ipl::bezier (Tf frac, const Tv &x2, const Tv &x1, const Tv &x0)
 Bezier curve, 3-point quadratic. More...
 
template<class Tf , class Tv >
Tv al::ipl::bezier (Tf frac, const Tv &x3, const Tv &x2, const Tv &x1, const Tv &x0)
 Bezier curve, 4-point cubic. More...
 
template<class Tf , class Tv >
Tv al::ipl::casteljau (const Tf &frac, const Tv &a, const Tv &b, const Tv &c, const Tv &d)
 de Casteljau algorithm for four point interpolation More...
 
template<class Tp , class Tv >
Tv al::ipl::hermite (Tp f, const Tv &w, const Tv &x, const Tv &y, const Tv &z, Tp tension, Tp bias)
 
template<class T >
void al::ipl::lagrange (T *h, T delay, int order)
 Computes FIR coefficients for Waring-Lagrange interpolation. More...
 
template<class T >
void al::ipl::lagrange1 (T *h, T delay)
 
template<class T >
void al::ipl::lagrange2 (T *h, T delay)
 
template<class T >
void al::ipl::lagrange3 (T *h, T delay)
 
template<class Tf , class Tv >
void al::ipl::cardinalSpline (Tv *w, const Tv *x, const Tf &f, double b)
 Compute weights for cubic cardinal spline. More...
 
template<class Tf , class Tv >
Tv al::ipl::cubic (Tf frac, const Tv &w, const Tv &x, const Tv &y, const Tv &z)
 Cubic interpolation. More...
 
template<class Tf , class Tv >
Tv al::ipl::cubic2 (Tf frac, const Tv &w, const Tv &x, const Tv &y, const Tv &z)
 Cubic interpolation. More...
 
template<class Tf , class Tv >
Tv al::ipl::linear (Tf frac, const Tv &x, const Tv &y)
 
template<class Tf , class Tv >
Tv al::ipl::linear (Tf frac, const Tv &x, const Tv &y, const Tv &z)
 
template<class Tf , class Tv >
Tv al::ipl::linearCyclic (Tf frac, const Tv &x, const Tv &y, const Tv &z)
 
template<class Tf , class Tv >
void al::ipl::linear (Tv *dst, const Tv *xs, const Tv *xp1s, int len, const Tf &frac)
 
template<class Tf , class Tv >
Tv al::ipl::nearest (Tf frac, const Tv &x, const Tv &y)
 
template<class Tf , class Tv >
Tv al::ipl::bilinear (const Tf &fracX, const Tf &fracY, const Tv &xy, const Tv &Xy, const Tv &xY, const Tv &XY)
 
template<class Tf2 , class Tv >
Tv al::ipl::bilinear (const Tf2 &f, const Tv &xy, const Tv &Xy, const Tv &xY, const Tv &XY)
 
template<class Tf , class Tv >
Tv al::ipl::trilinear (const Tf &fracX, const Tf &fracY, const Tf &fracZ, const Tv &xyz, const Tv &Xyz, const Tv &xYz, const Tv &XYz, const Tv &xyZ, const Tv &XyZ, const Tv &xYZ, const Tv &XYZ)
 
template<class Tf3 , class Tv >
Tv al::ipl::trilinear (const Tf3 &f, const Tv &xyz, const Tv &Xyz, const Tv &xYz, const Tv &XYz, const Tv &xyZ, const Tv &XyZ, const Tv &xYZ, const Tv &XYZ)
 Trilinear interpolation between values on corners of a hexahedron. More...
 

Detailed Description

Function Documentation

◆ aeq()

bool al::aeq ( float  a,
float  b,
int  maxULP = 10 
)
inline

Return whether two floats are almost equal.

Parameters
[in]afirst operand
[in]bsecond operand
[in]maxULPmaximum "units in the last place"

Algorithm from Dawson, B. "Comparing floating point numbers", http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

Definition at line 544 of file al_Functions.hpp.

◆ ampTodB()

template<class T >
T al::ampTodB ( const T &  amp)
inline

Convert amplitude to decibels

Definition at line 70 of file al_Functions.hpp.

◆ atan2Fast()

template<class T >
TEM T al::atan2Fast ( const T &  y,
const T &  x 
)

Fast approximation to atan2().

Definition at line 584 of file al_Functions.hpp.

◆ atLeast()

template<class T >
TEM T al::atLeast ( const T &  v,
const T &  eps 
)
inline

Returns value clipped ouside of range [-eps, eps]

Definition at line 580 of file al_Functions.hpp.

◆ bezier() [1/2]

template<class Tf , class Tv >
Tv al::ipl::bezier ( Tf  frac,
const Tv &  x2,
const Tv &  x1,
const Tv &  x0 
)
inline

Bezier curve, 3-point quadratic.

'frac' [0, 1) is the value on the curve btw x2 and x0

Definition at line 225 of file al_Interpolation.hpp.

◆ bezier() [2/2]

template<class Tf , class Tv >
Tv al::ipl::bezier ( Tf  frac,
const Tv &  x3,
const Tv &  x2,
const Tv &  x1,
const Tv &  x0 
)
inline

Bezier curve, 4-point cubic.

'frac' [0, 1) is the value on the curve btw x3 and x0

Definition at line 242 of file al_Interpolation.hpp.

◆ bilinear() [1/2]

template<class Tf , class Tv >
Tv al::ipl::bilinear ( const Tf &  fracX,
const Tf &  fracY,
const Tv &  xy,
const Tv &  Xy,
const Tv &  xY,
const Tv &  XY 
)
inline

Bilinear interpolation between values on corners of quadrilateral

Definition at line 182 of file al_Interpolation.hpp.

◆ bilinear() [2/2]

template<class Tf2 , class Tv >
Tv al::ipl::bilinear ( const Tf2 &  f,
const Tv &  xy,
const Tv &  Xy,
const Tv &  xY,
const Tv &  XY 
)
inline

Bilinear interpolation between values on corners of quadrilateral

Definition at line 191 of file al_Interpolation.hpp.

◆ bitsSet()

uint32_t al::bitsSet ( uint32_t  v)
inline

Returns number of bits set to 1.

From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

Definition at line 600 of file al_Functions.hpp.

◆ cardinalSpline()

template<class Tf , class Tv >
void al::ipl::cardinalSpline ( Tv *  w,
const Tv *  x,
const Tf &  f,
double  b 
)
inline

Compute weights for cubic cardinal spline.

Parameters
[out]woutput weights
[in]xinput domain values; spline in [x[1], x[2]]
[in]ffraction in [0,1]
[in]bsmoothness parameter in [-1,1]; 1 = Catmull-Rom

Definition at line 258 of file al_Interpolation.hpp.

◆ casteljau()

template<class Tf , class Tv >
Tv al::ipl::casteljau ( const Tf &  frac,
const Tv &  a,
const Tv &  b,
const Tv &  c,
const Tv &  d 
)

de Casteljau algorithm for four point interpolation

Parameters
fracInterpolation factor [0, 1]
aFirst point
bSecond point
cThird point
dFourth point

Definition at line 250 of file al_Interpolation.hpp.

◆ ceil()

template<class T >
TEM T al::ceil ( const T &  val,
const T &  step 
)
inline

Returns floating point value rounded to next highest integer.

Definition at line 606 of file al_Functions.hpp.

◆ ceilPow2()

uint32_t al::ceilPow2 ( uint32_t  value)
inline

Returns power of two ceiling of value.

This uses an algorithm devised by Sean Anderson, Sep. 2001. From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html.

Definition at line 611 of file al_Functions.hpp.

◆ clip() [1/2]

template<class T >
TEM T al::clip ( const T &  v,
int &  clipFlag,
const T &  hi,
const T &  lo 
)
inline

Returns value clipped to [lo, hi] and signifies clipping behavior.

clipFlag signifies if and where clipping occured. 0 means no clipping occured, -1 means clipping occured at the lower bound, and 1 means clipping at the upper bound.

Definition at line 629 of file al_Functions.hpp.

◆ clip() [2/2]

template<class T >
TEM T al::clip ( const T &  value,
const T &  hi = T(1),
const T &  lo = T(0) 
)
inline

Returns value clipped to [lo, hi]

Definition at line 621 of file al_Functions.hpp.

◆ clipS()

template<class T >
TEM T al::clipS ( const T &  value,
const T &  hi = T(1) 
)
inline

Returns value clipped to [-hi, hi].

Definition at line 641 of file al_Functions.hpp.

◆ cubic()

template<class Tf , class Tv >
Tv al::ipl::cubic ( Tf  frac,
const Tv &  w,
const Tv &  x,
const Tv &  y,
const Tv &  z 
)
inline

Cubic interpolation.

This is a Cardinal spline with a tension of 0 (AKA a Catmull-Rom spline).

Definition at line 286 of file al_Interpolation.hpp.

◆ cubic2()

template<class Tf , class Tv >
Tv al::ipl::cubic2 ( Tf  frac,
const Tv &  w,
const Tv &  x,
const Tv &  y,
const Tv &  z 
)
inline

Cubic interpolation.

This is a Cardinal spline with a tension of -1.

Definition at line 321 of file al_Interpolation.hpp.

◆ dBToAmp()

template<class T >
T al::dBToAmp ( const T &  db)
inline

Convert decibels to amplitude

Definition at line 143 of file al_Functions.hpp.

◆ erf()

template<class T >
TEM T al::erf ( const T &  x)
inline

The Gauss error function or probability integral

See also
http://en.wikipedia.org/wiki/Error_function
http://en.wikipedia.org/wiki/Error_function

Definition at line 646 of file al_Functions.hpp.

◆ even()

template<class T >
TEM bool al::even ( const T &  v)
inline

Returns whether or not an integer value is even.

Definition at line 643 of file al_Functions.hpp.

◆ factorial()

uint32_t al::factorial ( uint32_t  n0to12)
inline

Returns factorial. Argument must be less than or equal to 12.

Definition at line 654 of file al_Functions.hpp.

◆ factorialSqrt()

double al::factorialSqrt ( int  v)
inline

Returns square root of factorial

Definition at line 656 of file al_Functions.hpp.

◆ floor()

template<class T >
TEM T al::floor ( const T &  val,
const T &  step 
)
inline

Returns floor of floating point value.

Definition at line 663 of file al_Functions.hpp.

◆ floorPow2()

uint32_t al::floorPow2 ( uint32_t  value)
inline

Returns power of two floor of value.

This uses an algorithm devised by Sean Anderson, Sep. 2001. From "Bit Twiddling Hacks", http://graphics.stanford.edu/~seander/bithacks.html.

Definition at line 668 of file al_Functions.hpp.

◆ fold()

template<class T >
TEM T al::fold ( const T &  value,
const T &  hi = T(1),
const T &  lo = T(0) 
)
inline

Returns value folded into [lo, hi].

For out-of-range values, the boundaries act like mirrors reflecting the value into the range. For an even number of periods out of the range this is identical to a wrap().

Definition at line 677 of file al_Functions.hpp.

◆ foldOnce()

template<class T >
TEM T al::foldOnce ( const T &  value,
const T &  hi = T(1),
const T &  lo = T(0) 
)
inline

Returns value folded into [lo, hi] one time.

Definition at line 684 of file al_Functions.hpp.

◆ gaussian()

template<class T >
TEM T al::gaussian ( const T &  v)
inline

Returns e^(-v*v)

Definition at line 690 of file al_Functions.hpp.

◆ gcd()

template<class T >
TEM T al::gcd ( const T &  x,
const T &  y 
)

Return greatest common divisor of two arguments

Definition at line 692 of file al_Functions.hpp.

◆ gudermannian()

template<class T >
TEM T al::gudermannian ( const T &  x)

The Gudermannian function relates circular and hyperbolic functions without using complex numbers.

See also
http://en.wikipedia.org/wiki/Gudermannian_function
http://en.wikipedia.org/wiki/Gudermannian_function

Definition at line 698 of file al_Functions.hpp.

◆ hermite()

template<class Tp , class Tv >
Tv al::ipl::hermite ( Tp  f,
const Tv &  w,
const Tv &  x,
const Tv &  y,
const Tv &  z,
Tp  tension,
Tp  bias 
)
inline

Hermite interpolation

Definition at line 336 of file al_Interpolation.hpp.

◆ lagrange()

template<class T >
void al::ipl::lagrange ( T *  h,
delay,
int  order 
)

Computes FIR coefficients for Waring-Lagrange interpolation.

'h' are the FIR coefficients and should be of size ('order' + 1).
'delay' is a fractional delay in samples.
As order increases, this converges to sinc interpolation.

Definition at line 367 of file al_Interpolation.hpp.

◆ lagrange1()

template<class T >
void al::ipl::lagrange1 ( T *  h,
delay 
)
inline

Optimized lagrange() for first order.

Definition at line 382 of file al_Interpolation.hpp.

◆ lagrange2()

template<class T >
void al::ipl::lagrange2 ( T *  h,
delay 
)
inline

Optimized lagrange() for second order

Definition at line 388 of file al_Interpolation.hpp.

◆ lagrange3()

template<class T >
void al::ipl::lagrange3 ( T *  h,
delay 
)
inline

Optimized lagrange() for third order

Definition at line 395 of file al_Interpolation.hpp.

◆ laguerreL()

template<class T >
TEM T al::laguerreL ( int  n,
int  k,
x 
)

Generalized Laguerre polynomial L{n,k}.

Parameters
[in]ndegree, a non-negative integer
[in]korder
[in]xposition http://en.wikipedia.org/wiki/Laguerre_polynomials

Definition at line 700 of file al_Functions.hpp.

◆ legendreP()

template<class T >
TEM T al::legendreP ( int  l,
int  m,
t 
)

Associated Legendre polynomial

P_l^m(cos(t)) = (-1)^{l+m} / (2^l l!) sin^m(t) (d/d cos(t))^{l+m} sin^{2l}(t)

Parameters
[in]ldegree where l >= 0
[in]morder where 0 <= m <= l
[in]tangle in [0, pi]

http://comp.cs.ehime-u.ac.jp/~ogata/nac/index.html

Definition at line 834 of file al_Functions.hpp.

◆ lessAbs()

template<class T >
TEM bool al::lessAbs ( const T &  v,
const T &  eps = T(0.000001) 
)
inline

Returns whether the absolute value is less than an epsilon.

Definition at line 838 of file al_Functions.hpp.

◆ linear() [1/3]

template<class Tf , class Tv >
Tv al::ipl::linear ( Tf  frac,
const Tv &  x,
const Tv &  y 
)
inline

Linear interpolation. Identical to first order Lagrange.

Definition at line 417 of file al_Interpolation.hpp.

◆ linear() [2/3]

template<class Tf , class Tv >
Tv al::ipl::linear ( Tf  frac,
const Tv &  x,
const Tv &  y,
const Tv &  z 
)
inline

Linear interpolation between three elements

Definition at line 422 of file al_Interpolation.hpp.

◆ linear() [3/3]

template<class Tf , class Tv >
void al::ipl::linear ( Tv *  dst,
const Tv *  xs,
const Tv *  xp1s,
int  len,
const Tf &  frac 
)

Element-wise linear interpolation between two arrays of values

Definition at line 429 of file al_Interpolation.hpp.

◆ linearCyclic()

template<class Tf , class Tv >
Tv al::ipl::linearCyclic ( Tf  frac,
const Tv &  x,
const Tv &  y,
const Tv &  z 
)
inline

Cyclic linear interpolation between three elements

Definition at line 434 of file al_Interpolation.hpp.

◆ max()

template<typename T >
TEM T al::max ( const T &  v1,
const T &  v2,
const T &  v3 
)
inline

Returns maximum of three values

Definition at line 840 of file al_Functions.hpp.

◆ mean()

template<class T >
TEM T al::mean ( const T &  v1,
const T &  v2 
)
inline

Returns mean of two values

Definition at line 843 of file al_Functions.hpp.

◆ min()

template<class T >
TEM T al::min ( const T &  v1,
const T &  v2,
const T &  v3 
)
inline

Returns minimum of three values

Definition at line 844 of file al_Functions.hpp.

◆ nearest()

template<class Tf , class Tv >
Tv al::ipl::nearest ( Tf  frac,
const Tv &  x,
const Tv &  y 
)
inline

Nearest neighbor interpolation

Definition at line 444 of file al_Interpolation.hpp.

◆ nearestDiv()

template<class T >
T al::nearestDiv ( of,
to 
)
inline

Returns nearest integer division of one value to another

Definition at line 288 of file al_Functions.hpp.

◆ nextAfter()

template<class T >
TEM T al::nextAfter ( const T &  x,
const T &  y 
)
inline

Returns the next representable floating-point or integer value following x in the direction of y

Definition at line 863 of file al_Functions.hpp.

◆ nextMultiple()

template<class T >
TEM T al::nextMultiple ( val,
multiple 
)
inline

Returns next largest value of 'val' that is a multiple of 'multiple'.

Definition at line 866 of file al_Functions.hpp.

◆ numInt()

template<class T >
TEM T al::numInt ( const T &  v)
inline

Returns the number of digits in the integer portion

Definition at line 871 of file al_Functions.hpp.

◆ odd()

template<class T >
TEM bool al::odd ( const T &  v)
inline

Returns whether or not an integer value is odd.

Definition at line 873 of file al_Functions.hpp.

◆ poly() [1/2]

template<class T >
TEM T al::poly ( const T &  x,
const T &  a0,
const T &  a1,
const T &  a2 
)
inline

Evaluates polynomial a0 + a1 x + a2 x^2

Definition at line 875 of file al_Functions.hpp.

◆ poly() [2/2]

template<class T >
T al::poly ( const T &  x,
const T &  a0,
const T &  a1,
const T &  a2,
const T &  a3 
)

Evaluates polynomial a0 + a1 x + a2 x^2 + a3 x^3

◆ powN()

template<class T >
TEM T al::powN ( base,
unsigned  power 
)
inline

Returns value to a positive integer power.

Parameters
[in]basethe base value to exponentiate
[in]powerthe power to exponentiate by

Definition at line 893 of file al_Functions.hpp.

◆ prime()

uint8_t al::prime ( uint32_t  n)
inline

Returns (n+1)th prime number up to n=53.

Definition at line 923 of file al_Functions.hpp.

◆ rotatePlane()

template<class VecN , class T >
void al::rotatePlane ( VecN &  v1,
VecN &  v2,
const Complex< T > &  a 
)

Rotates two vectors by angle in plane formed from bivector v1 ^ v2

Definition at line 321 of file al_Complex.hpp.

◆ round() [1/2]

template<class T >
TEM T al::round ( const T &  v,
const T &  step 
)
inline

Returns value rounded to nearest integer multiple of 'step' towards zero.

Definition at line 925 of file al_Functions.hpp.

◆ round() [2/2]

template<class T >
TEM T al::round ( const T &  v,
const T &  step,
const T &  recStep 
)
inline

Returns value rounded to nearest integer multiple of 'step' towards zero. Faster version to avoid 1/step divide.

Definition at line 926 of file al_Functions.hpp.

◆ roundAway() [1/2]

template<class T >
TEM T al::roundAway ( const T &  v)
inline

Returns value rounded to nearest integer away from zero.

Definition at line 929 of file al_Functions.hpp.

◆ roundAway() [2/2]

template<class T >
TEM T al::roundAway ( const T &  v,
const T &  step 
)
inline

Returns value rounded to nearest to nearest integer multiple of 'step' away from zero.

Definition at line 932 of file al_Functions.hpp.

◆ sgn()

template<class T >
TEM T al::sgn ( const T &  v,
const T &  norm = T(1) 
)
inline

Signum function for real numbers

Definition at line 936 of file al_Functions.hpp.

◆ sinc()

template<class T >
TEM T al::sinc ( const T &  radians,
const T &  eps = T(0.0001) 
)
inline

Unnormalized sinc function

Definition at line 940 of file al_Functions.hpp.

◆ slope()

template<class T >
TEM T al::slope ( const T &  x1,
const T &  y1,
const T &  x2,
const T &  y2 
)
inline

Returns slope of line passing through two points.

Definition at line 944 of file al_Functions.hpp.

◆ sort()

template<class T >
TEM void al::sort ( T &  value1,
T &  value2 
)
inline

Sort values so that value1 <= value2.

Definition at line 948 of file al_Functions.hpp.

◆ sterProj()

template<class Vec3 , class T >
Vec3 al::sterProj ( const al::Complex< T > &  c)

Stereographically project complex number onto Riemann sphere

Definition at line 331 of file al_Complex.hpp.

◆ sumOfSquares()

template<class T >
TEM T al::sumOfSquares ( n)
inline

Sum of integers squared from 1 to n.

Definition at line 956 of file al_Functions.hpp.

◆ trailingZeroes()

uint32_t al::trailingZeroes ( uint32_t  v)
inline

Returns number of trailing zeros in 32-bit int.

This implements an algorithm from the paper "Using de Bruijn Sequences to Index 1 in a Computer Word" by Charles E. Leiserson, Harald Prokof, and Keith H. Randall.

Definition at line 962 of file al_Functions.hpp.

◆ trilinear() [1/2]

template<class Tf , class Tv >
Tv al::ipl::trilinear ( const Tf &  fracX,
const Tf &  fracY,
const Tf &  fracZ,
const Tv &  xyz,
const Tv &  Xyz,
const Tv &  xYz,
const Tv &  XYz,
const Tv &  xyZ,
const Tv &  XyZ,
const Tv &  xYZ,
const Tv &  XYZ 
)
inline

Trilinear interpolation between values on corners of a hexahedron

Definition at line 200 of file al_Interpolation.hpp.

◆ trilinear() [2/2]

template<class Tf3 , class Tv >
Tv al::ipl::trilinear ( const Tf3 &  f,
const Tv &  xyz,
const Tv &  Xyz,
const Tv &  xYz,
const Tv &  XYz,
const Tv &  xyZ,
const Tv &  XyZ,
const Tv &  xYZ,
const Tv &  XYZ 
)
inline

Trilinear interpolation between values on corners of a hexahedron.

Parameters
[in]f3 element array of fractions along x, y, and z

Definition at line 214 of file al_Interpolation.hpp.

◆ trunc() [1/2]

template<class T >
TEM T al::trunc ( const T &  v,
const T &  step 
)
inline

Truncates floating point value to step.

Definition at line 964 of file al_Functions.hpp.

◆ trunc() [2/2]

template<class T >
TEM T al::trunc ( const T &  v,
const T &  step,
const T &  recStep 
)
inline

Truncates floating point value to step. Faster version to avoid 1/step divide.

Definition at line 965 of file al_Functions.hpp.

◆ within()

template<class T >
TEM bool al::within ( const T &  v,
const T &  lo,
const T &  hi 
)
inline

Returns whether value is in interval [lo, hi].

Definition at line 969 of file al_Functions.hpp.

◆ within3()

template<class T >
TEM bool al::within3 ( const T &  v1,
const T &  v2,
const T &  v3,
const T &  lo,
const T &  hi 
)
inline

Returns whether 3 values are in interval [lo, hi].

Definition at line 976 of file al_Functions.hpp.

◆ withinIE()

template<class T >
TEM bool al::withinIE ( const T &  v,
const T &  lo,
const T &  hi 
)
inline

Returns whether value is in interval [lo, hi).

Definition at line 972 of file al_Functions.hpp.

◆ wrap() [1/2]

template<class T >
TEM T al::wrap ( const T &  value,
const T &  hi = T(1),
const T &  lo = T(0) 
)
inline

Returns value wrapped in [lo, hi).

Definition at line 983 of file al_Functions.hpp.

◆ wrap() [2/2]

template<class T >
TEM T al::wrap ( const T &  value,
long &  numWraps,
const T &  hi = T(1),
const T &  lo = T(0) 
)
inline

Returns value wrapped in [lo, hi).

'numWraps' reports how many wrappings occured where the sign, + or -, signifies above 'hi' or below 'lo', respectively.

Definition at line 1005 of file al_Functions.hpp.

◆ wrapAdd1()

template<class T >
T al::wrapAdd1 ( const T &  v,
const T &  max 
)

Returns value incremented by 1 and wrapped into interval [0, max).

Definition at line 479 of file al_Functions.hpp.

◆ wrapOnce()

template<class T >
TEM T al::wrapOnce ( const T &  value,
const T &  hi = T(1) 
)
inline

Like wrap(), but only adds or subtracts 'hi' once from value.

Definition at line 1033 of file al_Functions.hpp.

◆ wrapPhase()

template<class T >
TEM T al::wrapPhase ( const T &  radians)
inline

Returns value wrapped in [-pi, pi)

Definition at line 1049 of file al_Functions.hpp.

◆ wrapPhaseOnce()

template<class T >
TEM T al::wrapPhaseOnce ( const T &  radians)
inline

Like wrapPhase(), but only wraps once

Definition at line 1065 of file al_Functions.hpp.