10 #ifndef EIGEN_MATHFUNCTIONS_H    11 #define EIGEN_MATHFUNCTIONS_H    37 template<
typename T, 
typename dummy = 
void>
    48    typename 
always_void<typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl>
::type    51   typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl 
type;
    54 #define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl<typename Eigen::internal::global_math_functions_filtering_base<scalar>::type>    55 #define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval<typename Eigen::internal::global_math_functions_filtering_base<scalar>::type>::type    61 template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
    65   static inline RealScalar 
run(
const Scalar& x)
    71 template<
typename Scalar>
    75   static inline RealScalar 
run(
const Scalar& x)
    84 template<
typename Scalar>
    95 template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
    99   static inline RealScalar 
run(
const Scalar&)
   101     return RealScalar(0);
   105 template<
typename Scalar>
   109   static inline RealScalar 
run(
const Scalar& x)
   118 template<
typename Scalar>
   128 template<
typename Scalar>
   132   static inline RealScalar& 
run(Scalar& x)
   134     return reinterpret_cast<RealScalar*
>(&x)[0];
   136   static inline const RealScalar& 
run(
const Scalar& x)
   138     return reinterpret_cast<const RealScalar*
>(&x)[0];
   142 template<
typename Scalar>
   152 template<
typename Scalar, 
bool IsComplex>
   156   static inline RealScalar& 
run(Scalar& x)
   158     return reinterpret_cast<RealScalar*
>(&x)[1];
   160   static inline const RealScalar& 
run(
const Scalar& x)
   162     return reinterpret_cast<RealScalar*
>(&x)[1];
   166 template<
typename Scalar>
   169   static inline Scalar 
run(Scalar&)
   173   static inline const Scalar 
run(
const Scalar&)
   179 template<
typename Scalar>
   182 template<
typename Scalar>
   192 template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
   195   static inline Scalar 
run(
const Scalar& x)
   201 template<
typename Scalar>
   204   static inline Scalar 
run(
const Scalar& x)
   211 template<
typename Scalar>
   221 template<
typename Scalar>
   225   static inline RealScalar 
run(
const Scalar& x)
   231 template<
typename RealScalar>
   234   static inline RealScalar 
run(
const std::complex<RealScalar>& x)
   240 template<
typename Scalar>
   250 template<
typename Scalar, 
bool IsComplex>
   254   static inline RealScalar 
run(
const Scalar& x)
   261 template<
typename Scalar>
   264   static inline Scalar 
run(
const Scalar& x)
   271 template<
typename Scalar>
   274 template<
typename Scalar>
   284 template<
typename Scalar>
   288   static inline RealScalar 
run(
const Scalar& x, 
const Scalar& 
y)
   294     RealScalar _x = 
abs(x);
   295     RealScalar _y = 
abs(y);
   296     RealScalar p = (max)(_x, _y);
   297     if(p==RealScalar(0)) 
return 0;
   298     RealScalar q = (
min)(_x, _y);
   300     return p * 
sqrt(RealScalar(1) + qp*qp);
   304 template<
typename Scalar>
   314 template<
typename OldType, 
typename NewType>
   317   static inline NewType 
run(
const OldType& x)
   319     return static_cast<NewType
>(x);
   325 template<
typename OldType, 
typename NewType>
   326 inline NewType 
cast(
const OldType& x)
   335 template<
typename Scalar, 
bool IsInteger>
   340   static inline Scalar 
run(
const Scalar& x, 
const Scalar& 
y)
   347       return RealScalar(0.5) * 
log((y + x) / (y - x));
   349       return z + z*z*z / RealScalar(3);
   353 template<
typename Scalar>
   356   static inline Scalar 
run(
const Scalar&, 
const Scalar&)
   363 template<
typename Scalar>
   366 template<
typename Scalar>
   376 template<
typename Scalar, 
bool IsInteger>
   380   static inline Scalar 
run(
const Scalar& x, 
const Scalar& 
y)
   387 template<
typename Scalar>
   390   static inline Scalar 
run(Scalar x, Scalar 
y)
   406 template<
typename Scalar>
   409 template<
typename Scalar>
   419 template<
typename Scalar,
   424 template<
typename Scalar>
   427 template<
typename Scalar>
   436 template<typename Scalar>
   439   static inline Scalar 
run(
const Scalar& x, 
const Scalar& y)
   441     return x + (y-x) * Scalar(std::rand()) / Scalar(RAND_MAX);
   443   static inline Scalar 
run()
   458   enum { middle = (lower + upper) / 2,
   466 template<
unsigned int n,
   468          int upper = 
sizeof(
unsigned int) * CHAR_BIT - 1,
   472 template<
unsigned int n, 
int lower, 
int upper>
   478 template<
unsigned int n, 
int lower, 
int upper>
   484 template<
unsigned int n, 
int lower, 
int upper>
   487   enum { value = (n >= ((
unsigned int)(1) << (lower+1))) ? lower+1 : lower };
   490 template<
unsigned int n, 
int lower, 
int upper>
   496 template<
typename Scalar>
   501   static inline Scalar 
run(
const Scalar& x, 
const Scalar& 
y)
   503     return x + Scalar((NonInteger(y)-x+1) * std::rand() / (RAND_MAX + NonInteger(1)));
   506   static inline Scalar 
run()
   508 #ifdef EIGEN_MAKING_DOCS   512            scalar_bits = 
sizeof(Scalar) * CHAR_BIT,
   516     return Scalar((std::rand() >> shift) - offset);
   521 template<
typename Scalar>
   524   static inline Scalar 
run(
const Scalar& x, 
const Scalar& 
y)
   526     return Scalar(random(
real(x), 
real(y)),
   529   static inline Scalar 
run()
   532     return Scalar(random<RealScalar>(), random<RealScalar>());
   536 template<
typename Scalar>
   542 template<
typename Scalar>
   556 template<
typename Scalar>
   562 template<
typename Scalar>
   568 template<
typename Scalar>
   574 template<
typename Scalar>
   580 template<
typename Scalar>
   586 template<
typename Scalar>
   592 template<
typename Scalar>
   598 template<
typename Scalar>
   604 template<
typename Scalar>
   610 template<
typename Scalar>
   616 template<
typename Scalar>
   622 template<
typename Scalar>
   643 template<
typename Scalar,
   648 template<
typename Scalar>
   652   template<
typename OtherScalar>
   656     return abs(x) <= 
abs(y) * prec;
   658   static inline bool isApprox(
const Scalar& x, 
const Scalar& 
y, 
const RealScalar& prec)
   666     return x <= y || 
isApprox(x, y, prec);
   670 template<
typename Scalar>
   674   template<
typename OtherScalar>
   677     return x == Scalar(0);
   679   static inline bool isApprox(
const Scalar& x, 
const Scalar& 
y, 
const RealScalar&)
   689 template<
typename Scalar>
   693   template<
typename OtherScalar>
   698   static inline bool isApprox(
const Scalar& x, 
const Scalar& 
y, 
const RealScalar& prec)
   705 template<
typename Scalar>
   708 template<
typename Scalar, 
typename OtherScalar>
   715 template<
typename Scalar>
   716 inline bool isApprox(
const Scalar& x, 
const Scalar& y,
   722 template<
typename Scalar>
   737     return random<int>(0,1)==0 ? 
false : 
true;
   745   template<
typename OtherScalar>
   768 #endif // EIGEN_MATHFUNCTIONS_H 
internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar &x)
static bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &prec)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_pow_op< typename Derived::Scalar >, const Derived > pow(const Eigen::ArrayBase< Derived > &x, const typename Derived::Scalar &exponent)
static const RealScalar & run(const Scalar &x)
NumTraits< Scalar >::Real RealScalar
static bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &prec)
static Scalar run(Scalar &)
static Scalar run(const Scalar &x)
static const Scalar run(const Scalar &)
static Scalar run(const Scalar &, const Scalar &)
static RealScalar & run(Scalar &x)
NumTraits< Scalar >::Real RealScalar
const CwiseUnaryOp< internal::scalar_pow_op< Scalar >, const Derived > pow(const Scalar &exponent) const 
NumTraits< Scalar >::Real type
static Scalar run(const Scalar &x, const Scalar &y)
static Scalar run(const Scalar &x, const Scalar &y)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
static RealScalar run(const std::complex< RealScalar > &x)
#define EIGEN_PLAIN_ENUM_MIN(a, b)
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
NumTraits< Scalar >::Real & type
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::NonInteger NonInteger
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > abs2() const 
static RealScalar run(const Scalar &x, const Scalar &y)
const ImagReturnType imag() const 
NumTraits< Scalar >::Real RealScalar
NewType cast(const OldType &x)
static bool isMuchSmallerThan(const bool &x, const bool &, const bool &)
static Scalar run(const Scalar &x, const Scalar &y)
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const 
RealReturnType real() const 
static NewType run(const OldType &x)
static bool isApprox(const Scalar &x, const Scalar &y, const RealScalar &)
static Scalar run(const Scalar &x, const Scalar &y)
NumTraits< Scalar >::Real type
NumTraits< Scalar >::Real RealScalar
bool isApprox(const Scalar &x, const Scalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
NumTraits< Scalar >::Real & type
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Real type
static bool isApprox(bool x, bool y, bool)
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
const CwiseUnaryOp< internal::scalar_log_op< Scalar >, const Derived > log() const 
TFSIMD_FORCE_INLINE const tfScalar & x() const 
static bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const RealScalar &)
static bool isApproxOrLessThan(const bool &x, const bool &y, const bool &)
TFSIMD_FORCE_INLINE const tfScalar & z() const 
NumTraits< Scalar >::Real RealScalar
static Scalar run(const Scalar &x)
NumTraits< Scalar >::Real RealScalar
NumTraits< Scalar >::Real RealScalar
static RealScalar run(const Scalar &)
NumTraits< Scalar >::Real type
static Scalar run(const Scalar &x, const Scalar &y)
NumTraits< Scalar >::Real type
static bool isMuchSmallerThan(const Scalar &x, const Scalar &, const RealScalar &)
NumTraits< Scalar >::Real RealScalar
static const RealScalar & run(const Scalar &x)
bool isApproxOrLessThan(const Scalar &x, const Scalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
NumTraits< Scalar >::Real RealScalar
static RealScalar & run(Scalar &x)
static RealScalar run(const Scalar &x)
T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type
internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar &x)
static Scalar run(const Scalar &x)
static Scalar run(Scalar x, Scalar y)
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > sqrt() const 
static bool isApproxOrLessThan(const Scalar &x, const Scalar &y, const RealScalar &prec)
static RealScalar run(const Scalar &x)
NumTraits< Scalar >::Real RealScalar
static bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const RealScalar &prec)
static RealScalar run(const Scalar &x)
static bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const RealScalar &prec)
NumTraits< Scalar >::Real RealScalar
void run(ClassLoader *loader)
bool() isfinite(const T &x)
EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar &x
#define EIGEN_PLAIN_ENUM_MAX(a, b)
static RealScalar run(const Scalar &x)
#define EIGEN_MATHFUNC_IMPL(func, scalar)
static RealScalar run(const Scalar &x)