1 #ifndef _GLUCAT_SCALAR_H 2 #define _GLUCAT_SCALAR_H 36 #include <boost/numeric/ublas/traits.hpp> 45 template<
typename Scalar_T >
85 bool_to_type< std::numeric_limits<Scalar_T>::has_infinity >() );
95 bool_to_type< std::numeric_limits<Scalar_T>::has_quiet_NaN >() );
105 bool_to_type< std::numeric_limits<Scalar_T>::has_quiet_NaN >() )
107 bool_to_type< std::numeric_limits<Scalar_T>::has_infinity >() );
116 return std::numeric_limits<Scalar_T>::has_quiet_NaN
117 ? std::numeric_limits<Scalar_T>::quiet_NaN()
126 {
return static_cast<int>(val); }
133 {
return static_cast<double>(val); }
136 template <
typename Other_Scalar_T >
141 {
return static_cast<Scalar_T
>(val); }
153 fmod(
const Scalar_T& lhs,
const Scalar_T& rhs)
154 {
return std::fmod(lhs, rhs); }
175 {
return Scalar_T(0); }
189 {
return Scalar_T(3.14159265358979323); }
196 {
return Scalar_T(0.693147180559945309); }
202 pow(
const Scalar_T& val,
int n)
299 template<
typename Scalar_T >
306 #endif // _GLUCAT_SCALAR_H static int to_int(const Scalar_T &val)
Cast to int.
static bool isInf(const Scalar_T &val)
Smart isinf.
static bool isNaN_or_isInf(const Scalar_T &val)
Smart isnan or isinf.
static bool isNaN(const Scalar_T &val, bool_to_type< true >)
Smart isnan specialised for Scalar_T with quiet NaN.
static Scalar_T cosh(const Scalar_T &val)
Hyperbolic cosine of scalar.
static Scalar_T sin(const Scalar_T &val)
Sine of scalar.
const Multivector< Scalar_T, LO, HI > sinh(const Multivector< Scalar_T, LO, HI > &val)
Hyperbolic sine of multivector.
static Scalar_T to_scalar_t(const Other_Scalar_T &val)
Cast to Scalar_T.
static Scalar_T exp(const Scalar_T &val)
Exponential.
static Scalar_T log2(const Scalar_T &val)
Log base 2.
const Multivector< Scalar_T, LO, HI > log(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Natural logarithm of multivector with specified complexifier.
static Scalar_T tan(const Scalar_T &val)
Tangent of scalar.
static Scalar_T conj(const Scalar_T &val)
Complex conjugate of scalar.
static bool isInf(const Scalar_T &val, bool_to_type< false >)
Smart isinf specialised for Scalar_T without infinity.
Extra traits which extend numeric limits.
static Scalar_T acos(const Scalar_T &val)
Inverse cosine of scalar.
static Scalar_T cos(const Scalar_T &val)
Cosine of scalar.
const Multivector< Scalar_T, LO, HI > pow(const Multivector< Scalar_T, LO, HI > &lhs, int rhs)
Integer power of multivector.
static Scalar_T fmod(const Scalar_T &lhs, const Scalar_T &rhs)
Modulo function for scalar.
static Scalar_T NaN()
Smart NaN.
static Scalar_T imag(const Scalar_T &val)
Imaginary part of scalar.
static bool isInf(const Scalar_T &val, bool_to_type< true >)
Smart isinf specialised for Scalar_T with infinity.
Demoted type for long double.
static Scalar_T abs(const Scalar_T &val)
Absolute value of scalar.
const Multivector< Scalar_T, LO, HI > sin(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Sine of multivector with specified complexifier.
const framed_multi< Scalar_T, LO, HI > exp(const framed_multi< Scalar_T, LO, HI > &val)
Exponential of multivector.
static Scalar_T sqrt(const Scalar_T &val)
Square root of scalar.
const Multivector< Scalar_T, LO, HI > cos(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Cosine of multivector with specified complexifier.
static Scalar_T tanh(const Scalar_T &val)
Hyperbolic tangent of scalar.
static Scalar_T atan(const Scalar_T &val)
Inverse tangent of scalar.
const Multivector< Scalar_T, LO, HI > tanh(const Multivector< Scalar_T, LO, HI > &val)
Hyperbolic tangent of multivector.
static Scalar_T log(const Scalar_T &val)
Logarithm of scalar.
const Multivector< Scalar_T, LO, HI > asin(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Inverse sine of multivector with specified complexifier.
static Scalar_T pow(const Scalar_T &val, int n)
Integer power.
static Scalar_T real(const Scalar_T &val)
Real part of scalar.
static double to_double(const Scalar_T &val)
Cast to double.
static bool isNaN(const Scalar_T &val)
Smart isnan.
const Multivector< Scalar_T, LO, HI > atan(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Inverse tangent of multivector with specified complexifier.
const Multivector< Scalar_T, LO, HI > tan(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Tangent of multivector with specified complexifier.
static Scalar_T asin(const Scalar_T &val)
Inverse sine of scalar.
static Scalar_T ln_2()
log(2)
const Multivector< Scalar_T, LO, HI > acos(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Inverse cosine of multivector with specified complexifier.
const Multivector< Scalar_T, LO, HI > cosh(const Multivector< Scalar_T, LO, HI > &val)
Hyperbolic cosine of multivector.
static Scalar_T sinh(const Scalar_T &val)
Hyperbolic sine of scalar.
static bool isNaN(const Scalar_T &val, bool_to_type< false >)
Smart isnan specialised for Scalar_T without quiet NaN.