1 #ifndef _GLUCAT_SCALAR_H 2 #define _GLUCAT_SCALAR_H 37 #include <boost/numeric/ublas/traits.hpp> 46 template<
typename Scalar_T >
83 isInf(
const Scalar_T& val) ->
bool 86 bool_to_type< std::numeric_limits<Scalar_T>::has_infinity >() );
93 isNaN(
const Scalar_T& val) ->
bool 96 bool_to_type< std::numeric_limits<Scalar_T>::has_quiet_NaN >() );
106 bool_to_type< std::numeric_limits<Scalar_T>::has_quiet_NaN >() )
108 bool_to_type< std::numeric_limits<Scalar_T>::has_infinity >() );
117 return std::numeric_limits<Scalar_T>::has_quiet_NaN
118 ? std::numeric_limits<Scalar_T>::quiet_NaN()
127 {
return static_cast<int>(val); }
134 {
return static_cast<double>(val); }
137 template <
typename Other_Scalar_T >
142 {
return static_cast<Scalar_T
>(val); }
155 {
return std::fmod(
lhs,
rhs); }
161 conj(
const Scalar_T& val) -> Scalar_T
168 real(
const Scalar_T& val) -> Scalar_T
175 imag(
const Scalar_T& val) -> Scalar_T
176 {
return Scalar_T(0); }
182 abs(
const Scalar_T& val) -> Scalar_T
190 {
return Scalar_T(3.14159265358979323); }
197 {
return Scalar_T(0.693147180559945309); }
203 pow(
const Scalar_T& val,
int n) -> Scalar_T
210 sqrt(
const Scalar_T& val) -> Scalar_T
217 exp(
const Scalar_T& val) -> Scalar_T
224 log(
const Scalar_T& val) -> Scalar_T
231 log2(
const Scalar_T& val) -> Scalar_T
238 cos(
const Scalar_T& val) -> Scalar_T
245 acos(
const Scalar_T& val) -> Scalar_T
252 cosh(
const Scalar_T& val) -> Scalar_T
259 sin(
const Scalar_T& val) -> Scalar_T
266 asin(
const Scalar_T& val) -> Scalar_T
273 sinh(
const Scalar_T& val) -> Scalar_T
280 tan(
const Scalar_T& val) -> Scalar_T
287 atan(
const Scalar_T& val) -> Scalar_T
294 tanh(
const Scalar_T& val) -> Scalar_T
300 template<
typename Scalar_T >
303 log2(
const Scalar_T& x) -> Scalar_T
307 #endif // _GLUCAT_SCALAR_H static auto log2(const Scalar_T &val) -> Scalar_T
Log base 2.
static auto sinh(const Scalar_T &val) -> Scalar_T
Hyperbolic sine of scalar.
static auto asin(const Scalar_T &val) -> Scalar_T
Inverse sine of scalar.
static auto isNaN(const Scalar_T &val) -> bool
Smart isnan.
static auto cosh(const Scalar_T &val) -> Scalar_T
Hyperbolic cosine of scalar.
auto exp(const framed_multi< Scalar_T, LO, HI, Tune_P > &val) -> const framed_multi< Scalar_T, LO, HI, Tune_P >
Exponential of multivector.
static auto imag(const Scalar_T &val) -> Scalar_T
Imaginary part of scalar.
static auto atan(const Scalar_T &val) -> Scalar_T
Inverse tangent of scalar.
static auto tan(const Scalar_T &val) -> Scalar_T
Tangent of scalar.
static auto isNaN_or_isInf(const Scalar_T &val) -> bool
Smart isnan or isinf.
static auto NaN() -> Scalar_T
Smart NaN.
Extra traits which extend numeric limits.
static auto isInf(const Scalar_T &val, bool_to_type< false >) -> bool
Smart isinf specialised for Scalar_T without infinity.
static auto to_int(const Scalar_T &val) -> int
Cast to int.
static auto fmod(const Scalar_T &lhs, const Scalar_T &rhs) -> Scalar_T
Modulo function for scalar.
static auto pow(const Scalar_T &val, int n) -> Scalar_T
Integer power.
auto log(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Natural logarithm of multivector with specified complexifier.
static auto exp(const Scalar_T &val) -> Scalar_T
Exponential.
auto sinh(const Multivector< Scalar_T, LO, HI, Tune_P > &val) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Hyperbolic sine of multivector.
static auto ln_2() -> Scalar_T
log(2)
static auto conj(const Scalar_T &val) -> Scalar_T
Complex conjugate of scalar.
static auto sin(const Scalar_T &val) -> Scalar_T
Sine of scalar.
Demoted type for long double.
static auto log(const Scalar_T &val) -> Scalar_T
Logarithm of scalar.
static auto acos(const Scalar_T &val) -> Scalar_T
Inverse cosine of scalar.
auto asin(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Inverse sine of multivector with specified complexifier.
auto tanh(const Multivector< Scalar_T, LO, HI, Tune_P > &val) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Hyperbolic tangent of multivector.
auto log2(const Scalar_T &x) -> Scalar_T
Log base 2 of scalar.
auto tan(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Tangent of multivector with specified complexifier.
static auto isNaN(const Scalar_T &val, bool_to_type< true >) -> bool
Smart isnan specialised for Scalar_T with quiet NaN.
static auto to_double(const Scalar_T &val) -> double
Cast to double.
auto cos(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Cosine of multivector with specified complexifier.
static auto abs(const Scalar_T &val) -> Scalar_T
Absolute value of scalar.
auto atan(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Inverse tangent of multivector with specified complexifier.
static auto pi() -> Scalar_T
Pi.
static auto tanh(const Scalar_T &val) -> Scalar_T
Hyperbolic tangent of scalar.
static auto isInf(const Scalar_T &val) -> bool
Smart isinf.
static auto sqrt(const Scalar_T &val) -> Scalar_T
Square root of scalar.
static auto to_scalar_t(const Other_Scalar_T &val) -> Scalar_T
Cast to Scalar_T.
auto pow(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, int rhs) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Integer power of multivector.
auto sin(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Sine of multivector with specified complexifier.
static auto cos(const Scalar_T &val) -> Scalar_T
Cosine of scalar.
auto cosh(const Multivector< Scalar_T, LO, HI, Tune_P > &val) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Hyperbolic cosine of multivector.
static auto isNaN(const Scalar_T &val, bool_to_type< false >) -> bool
Smart isnan specialised for Scalar_T without quiet NaN.
auto acos(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Inverse cosine of multivector with specified complexifier.
static auto isInf(const Scalar_T &val, bool_to_type< true >) -> bool
Smart isinf specialised for Scalar_T with infinity.
static auto real(const Scalar_T &val) -> Scalar_T
Real part of scalar.