Go to the documentation of this file. 1 #ifndef _GLUCAT_SCALAR_H
2 #define _GLUCAT_SCALAR_H
36 #include <boost/numeric/ublas/traits.hpp>
45 template<
typename Scalar_T >
53 isInf(
const Scalar_T& val, bool_to_type<false>)
60 isInf(
const Scalar_T& val, bool_to_type<true>)
67 isNaN(
const Scalar_T& val, bool_to_type<false>)
74 isNaN(
const Scalar_T& val, bool_to_type<true>)
82 isInf(
const Scalar_T& val)
85 bool_to_type< std::numeric_limits<Scalar_T>::has_infinity >() );
92 isNaN(
const Scalar_T& val)
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); }
144 struct promoted {
typedef double type;};
147 struct demoted {
typedef float type;};
153 fmod(
const Scalar_T& lhs,
const Scalar_T& rhs)
154 {
return std::fmod(lhs, rhs); }
167 real(
const Scalar_T& val)
174 imag(
const Scalar_T& val)
175 {
return Scalar_T(0); }
181 abs(
const Scalar_T& val)
189 {
return Scalar_T(3.14159265358979323); }
196 {
return Scalar_T(0.693147180559945309); }
202 pow(
const Scalar_T& val,
int n)
209 sqrt(
const Scalar_T& val)
216 exp(
const Scalar_T& val)
223 log(
const Scalar_T& val)
230 log2(
const Scalar_T& val)
237 cos(
const Scalar_T& val)
244 acos(
const Scalar_T& val)
251 cosh(
const Scalar_T& val)
258 sin(
const Scalar_T& val)
265 asin(
const Scalar_T& val)
272 sinh(
const Scalar_T& val)
279 tan(
const Scalar_T& val)
286 atan(
const Scalar_T& val)
293 tanh(
const Scalar_T& val)
299 template<
typename Scalar_T >
306 #endif // _GLUCAT_SCALAR_H
static Scalar_T imag(const Scalar_T &val)
Imaginary part of scalar.
static Scalar_T conj(const Scalar_T &val)
Complex conjugate of scalar.
static Scalar_T log2(const Scalar_T &val)
Log base 2.
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 cos(const Scalar_T &val)
Cosine of scalar.
static Scalar_T atan(const Scalar_T &val)
Inverse tangent of scalar.
static bool isNaN_or_isInf(const Scalar_T &val)
Smart isnan or isinf.
static Scalar_T pow(const Scalar_T &val, int n)
Integer power.
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.
static Scalar_T exp(const Scalar_T &val)
Exponential.
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 fmod(const Scalar_T &lhs, const Scalar_T &rhs)
Modulo function for scalar.
static Scalar_T tanh(const Scalar_T &val)
Hyperbolic tangent of scalar.
static bool isInf(const Scalar_T &val, bool_to_type< false >)
Smart isinf specialised for Scalar_T without infinity.
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 acos(const Scalar_T &val)
Inverse cosine of scalar.
static Scalar_T sin(const Scalar_T &val)
Sine of scalar.
static Scalar_T NaN()
Smart NaN.
static int to_int(const Scalar_T &val)
Cast to int.
const Multivector< Scalar_T, LO, HI > sinh(const Multivector< Scalar_T, LO, HI > &val)
Hyperbolic sine of multivector.
static Scalar_T ln_2()
log(2)
static Scalar_T to_scalar_t(const Other_Scalar_T &val)
Cast to Scalar_T.
static Scalar_T asin(const Scalar_T &val)
Inverse sine of scalar.
static Scalar_T log(const Scalar_T &val)
Logarithm of scalar.
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 double to_double(const Scalar_T &val)
Cast to double.
static bool isNaN(const Scalar_T &val, bool_to_type< false >)
Smart isnan specialised for Scalar_T without quiet NaN.
static Scalar_T real(const Scalar_T &val)
Real part of scalar.
const Multivector< Scalar_T, LO, HI > pow(const Multivector< Scalar_T, LO, HI > &lhs, int rhs)
Integer power of multivector.
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.
static Scalar_T tan(const Scalar_T &val)
Tangent of scalar.
static Scalar_T sqrt(const Scalar_T &val)
Square root of scalar.
static Scalar_T sinh(const Scalar_T &val)
Hyperbolic sine 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.
const framed_multi< Scalar_T, LO, HI > exp(const framed_multi< Scalar_T, LO, HI > &val)
Exponential of multivector.
Scalar_T log2(const Scalar_T &x)
Log base 2 of scalar.
const Multivector< Scalar_T, LO, HI > tanh(const Multivector< Scalar_T, LO, HI > &val)
Hyperbolic tangent of multivector.
static Scalar_T cosh(const Scalar_T &val)
Hyperbolic cosine of scalar.
static Scalar_T abs(const Scalar_T &val)
Absolute value of scalar.