Honeycomb  0.1
Component-Model Framework
Static Public Member Functions | Static Public Attributes | List of all members
honey::Alge_< Real > Class Template Reference

Algebra. More...

#include <Alge.h>

Inheritance diagram for honey::Alge_< Real >:
Inheritance graph
[legend]
Collaboration diagram for honey::Alge_< Real >:
Collaboration graph
[legend]

Static Public Member Functions

static Int abs (Int x)
 Get absolute value of signed integer. More...
 
static UInt abs (UInt x)
 Get absolute value of unsigned integer. More...
 
static Real abs (Real x)
 Get absolute value of real number. More...
 
static Int sign (Int x)
 Get sign of number {-1,0,1}. More...
 
static UInt sign (UInt x)
 
static Real sign (Real x)
 
static Real ceil (Real x)
 Round up to the nearest whole number towards +inf. More...
 
static Real floor (Real x)
 Round down to the nearest whole number towards -inf. More...
 
static Real round (Real x)
 Round to the nearest whole number. More...
 
static Real trunc (Real x)
 Remove fractional part, leaving just the whole number. More...
 
static Real frac (Real x)
 Remove the whole part, leaving just the fraction. More...
 
static Real mod (Real x, Real y)
 Modulo, same as x % y. Returns remainder of division: x/y. More...
 
static Real modNormalize (Real mod, Real val)
 Get an equivalent value in the normalized modular interval [-mod, mod]. More...
 
static Real modDistSigned (Real mod, Real x, Real y)
 Calc smallest signed distance between two normalized values in a modular field. More...
 
template<class Num >
static Num sqr (Num x)
 Square. More...
 
static Real sqrt (Real x)
 Square Root. More...
 
static Real sqrtInv (Real x)
 Inverse Square Root. More...
 
static Real exp (Real x)
 Euler's number e raised to exponent x (e^x) More...
 
static Real expm1 (Real x)
 exp(x) - 1, more accurate than exp() for small values of x. More...
 
static Real pow (Real x, Real y)
 x raised to exponent y More...
 
static Real log (Real x)
 Natural logarithm. ie. ln(x) More...
 
static Real log (Real x, Real base)
 Logarithm with base number. More...
 
static Real log1p (Real x)
 log(1 + x), more accurate than log() for small values of x. More...
 
template<class Num , class Num2 >
static std::common_type< Num, Num2 >::type min (Num a, Num2 b)
 Get the minimum of two numbers. More...
 
template<class Num , class Num2 >
static std::common_type< Num, Num2 >::type max (Num a, Num2 b)
 Get the maximum of two numbers. More...
 
template<class Num , class Num2 , class Num3 >
static std::common_type< Num, Num2, Num3 >::type clamp (Num val, Num2 min, Num3 max)
 Ensure that a number is within a range. More...
 
static bool isNan (Real x)
 Returns true if real is not a number. More...
 
static bool isNear (Int a, Int b, Int tol)
 Check whether two numbers are near each other, given a tolerance. More...
 
static bool isNear (Real a, Real b, Real tol=Real_::zeroTol)
 
static bool isNearZero (Real val, Real tol=Real_::zeroTol)
 Check whether a number is close to zero. More...
 
template<class Num , class Num2 , class Num3 >
static bool isInRange (Num val, Num2 min, Num3 max)
 Check if value is within min/max inclusive range. More...
 
static Real hypot (Real a, Real b)
 Get the hypotenuse of a right angle triangle with side lengths a and b. This method is more numerically stable than the direct approach: sqrt(a*a + b*b) More...
 
static tuple< bool, Real, Realsolve (Real a, Real b, Real c, Real d, Real u, Real v)
 Solve an equation pair using Gauss-Jordan elimination. More...
 

Static Public Attributes

static const Real logMin = log(numeral<Real>().smallest())
 The lowest negative value x for which exp(x) can be calucated without underflow. More...
 
static const Real logMax = log(numeral<Real>().max())
 The highest value x for which exp(x) can be calucated without overflow. More...
 

Detailed Description

template<class Real>
class honey::Alge_< Real >

Algebra.

Member Function Documentation

template<class Real >
static Int honey::Alge_< Real >::abs ( Int  x)
inlinestatic

Get absolute value of signed integer.

template<class Real >
static UInt honey::Alge_< Real >::abs ( UInt  x)
inlinestatic

Get absolute value of unsigned integer.

template<class Real >
static Real honey::Alge_< Real >::abs ( Real  x)
inlinestatic

Get absolute value of real number.

template<class Real >
static Real honey::Alge_< Real >::ceil ( Real  x)
inlinestatic

Round up to the nearest whole number towards +inf.

template<class Real >
template<class Num , class Num2 , class Num3 >
static std::common_type<Num, Num2, Num3>::type honey::Alge_< Real >::clamp ( Num  val,
Num2  min,
Num3  max 
)
inlinestatic

Ensure that a number is within a range.

template<class Real >
static Real honey::Alge_< Real >::exp ( Real  x)
inlinestatic

Euler's number e raised to exponent x (e^x)

template<class Real >
Real honey::Alge_< Real >::expm1 ( Real  x)
static

exp(x) - 1, more accurate than exp() for small values of x.

template<class Real >
static Real honey::Alge_< Real >::floor ( Real  x)
inlinestatic

Round down to the nearest whole number towards -inf.

template<class Real >
static Real honey::Alge_< Real >::frac ( Real  x)
inlinestatic

Remove the whole part, leaving just the fraction.

template<class Real >
Real honey::Alge_< Real >::hypot ( Real  a,
Real  b 
)
static

Get the hypotenuse of a right angle triangle with side lengths a and b. This method is more numerically stable than the direct approach: sqrt(a*a + b*b)

template<class Real >
template<class Num , class Num2 , class Num3 >
static bool honey::Alge_< Real >::isInRange ( Num  val,
Num2  min,
Num3  max 
)
inlinestatic

Check if value is within min/max inclusive range.

template<class Real >
static bool honey::Alge_< Real >::isNan ( Real  x)
inlinestatic

Returns true if real is not a number.

template<class Real >
static bool honey::Alge_< Real >::isNear ( Int  a,
Int  b,
Int  tol 
)
inlinestatic

Check whether two numbers are near each other, given a tolerance.

template<class Real >
static bool honey::Alge_< Real >::isNear ( Real  a,
Real  b,
Real  tol = Real_::zeroTol 
)
inlinestatic
template<class Real >
static bool honey::Alge_< Real >::isNearZero ( Real  val,
Real  tol = Real_::zeroTol 
)
inlinestatic

Check whether a number is close to zero.

template<class Real >
static Real honey::Alge_< Real >::log ( Real  x)
inlinestatic

Natural logarithm. ie. ln(x)

template<class Real >
static Real honey::Alge_< Real >::log ( Real  x,
Real  base 
)
inlinestatic

Logarithm with base number.

template<class Real >
Real honey::Alge_< Real >::log1p ( Real  x)
static

log(1 + x), more accurate than log() for small values of x.

template<class Real >
template<class Num , class Num2 >
static std::common_type<Num, Num2>::type honey::Alge_< Real >::max ( Num  a,
Num2  b 
)
inlinestatic

Get the maximum of two numbers.

template<class Real >
template<class Num , class Num2 >
static std::common_type<Num, Num2>::type honey::Alge_< Real >::min ( Num  a,
Num2  b 
)
inlinestatic

Get the minimum of two numbers.

template<class Real >
static Real honey::Alge_< Real >::mod ( Real  x,
Real  y 
)
inlinestatic

Modulo, same as x % y. Returns remainder of division: x/y.

template<class Real >
static Real honey::Alge_< Real >::modDistSigned ( Real  mod,
Real  x,
Real  y 
)
inlinestatic

Calc smallest signed distance between two normalized values in a modular field.

template<class Real >
static Real honey::Alge_< Real >::modNormalize ( Real  mod,
Real  val 
)
inlinestatic

Get an equivalent value in the normalized modular interval [-mod, mod].

template<class Real >
static Real honey::Alge_< Real >::pow ( Real  x,
Real  y 
)
inlinestatic

x raised to exponent y

template<class Real >
static Real honey::Alge_< Real >::round ( Real  x)
inlinestatic

Round to the nearest whole number.

template<class Real >
static Int honey::Alge_< Real >::sign ( Int  x)
inlinestatic

Get sign of number {-1,0,1}.

template<class Real >
static UInt honey::Alge_< Real >::sign ( UInt  x)
inlinestatic
template<class Real >
static Real honey::Alge_< Real >::sign ( Real  x)
inlinestatic
template<class Real >
tuple< bool, Real, Real > honey::Alge_< Real >::solve ( Real  a,
Real  b,
Real  c,
Real  d,
Real  u,
Real  v 
)
static

Solve an equation pair using Gauss-Jordan elimination.

This method solves for x and y:
$ ax + by = u $
$ cx + dy = v $

Return values
solvedif false then there is no unique solution (determinant is 0)
x
y
template<class Real >
template<class Num >
static Num honey::Alge_< Real >::sqr ( Num  x)
inlinestatic

Square.

template<class Real >
static Real honey::Alge_< Real >::sqrt ( Real  x)
inlinestatic

Square Root.

template<class Real >
static Real honey::Alge_< Real >::sqrtInv ( Real  x)
inlinestatic

Inverse Square Root.

template<class Real >
static Real honey::Alge_< Real >::trunc ( Real  x)
inlinestatic

Remove fractional part, leaving just the whole number.

Member Data Documentation

template<class Real >
const Real honey::Alge_< Real >::logMax = log(numeral<Real>().max())
static

The highest value x for which exp(x) can be calucated without overflow.

template<class Real >
const Real honey::Alge_< Real >::logMin = log(numeral<Real>().smallest())
static

The lowest negative value x for which exp(x) can be calucated without underflow.


The documentation for this class was generated from the following files: