diff options
author | David Tellenbach <david.tellenbach@me.com> | 2020-10-09 02:05:05 +0200 |
---|---|---|
committer | David Tellenbach <david.tellenbach@me.com> | 2020-10-09 02:05:05 +0200 |
commit | 4091f6b25c5ad0ca3f7c00bd82bfd7ca1bbedee3 (patch) | |
tree | c464c196d1f0f125532d2a162c99b80c00fb7255 /Eigen/src/Core | |
parent | 183a208212353ccf81a664d25dc7660b6269acdd (diff) |
Drop EIGEN_USING_STD_MATH in favour of EIGEN_USING_STD
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/Dot.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/GenericPacketMath.h | 30 | ||||
-rw-r--r-- | Eigen/src/Core/MathFunctions.h | 68 | ||||
-rw-r--r-- | Eigen/src/Core/MathFunctionsImpl.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/functors/UnaryFunctors.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 14 |
6 files changed, 53 insertions, 67 deletions
diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index 11da432b2..41a8cb437 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -207,7 +207,7 @@ struct lpNorm_selector EIGEN_DEVICE_FUNC static inline RealScalar run(const MatrixBase<Derived>& m) { - EIGEN_USING_STD_MATH(pow) + EIGEN_USING_STD(pow) return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); } }; diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 7a84841fa..3c5810901 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -264,7 +264,7 @@ plogical_shift_left(const long int& a) { return a << N; } template <typename Packet> EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { int exp; - EIGEN_USING_STD_MATH(frexp); + EIGEN_USING_STD(frexp); Packet result = frexp(a, &exp); exponent = static_cast<Packet>(exp); return result; @@ -275,7 +275,7 @@ EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { */ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pldexp(const Packet &a, const Packet &exponent) { - EIGEN_USING_STD_MATH(ldexp) + EIGEN_USING_STD(ldexp) return ldexp(a, static_cast<int>(exponent)); } @@ -574,43 +574,43 @@ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet /** \internal \returns the sine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psin(const Packet& a) { EIGEN_USING_STD_MATH(sin); return sin(a); } +Packet psin(const Packet& a) { EIGEN_USING_STD(sin); return sin(a); } /** \internal \returns the cosine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pcos(const Packet& a) { EIGEN_USING_STD_MATH(cos); return cos(a); } +Packet pcos(const Packet& a) { EIGEN_USING_STD(cos); return cos(a); } /** \internal \returns the tan of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet ptan(const Packet& a) { EIGEN_USING_STD_MATH(tan); return tan(a); } +Packet ptan(const Packet& a) { EIGEN_USING_STD(tan); return tan(a); } /** \internal \returns the arc sine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pasin(const Packet& a) { EIGEN_USING_STD_MATH(asin); return asin(a); } +Packet pasin(const Packet& a) { EIGEN_USING_STD(asin); return asin(a); } /** \internal \returns the arc cosine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pacos(const Packet& a) { EIGEN_USING_STD_MATH(acos); return acos(a); } +Packet pacos(const Packet& a) { EIGEN_USING_STD(acos); return acos(a); } /** \internal \returns the arc tangent of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet patan(const Packet& a) { EIGEN_USING_STD_MATH(atan); return atan(a); } +Packet patan(const Packet& a) { EIGEN_USING_STD(atan); return atan(a); } /** \internal \returns the hyperbolic sine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psinh(const Packet& a) { EIGEN_USING_STD_MATH(sinh); return sinh(a); } +Packet psinh(const Packet& a) { EIGEN_USING_STD(sinh); return sinh(a); } /** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pcosh(const Packet& a) { EIGEN_USING_STD_MATH(cosh); return cosh(a); } +Packet pcosh(const Packet& a) { EIGEN_USING_STD(cosh); return cosh(a); } /** \internal \returns the hyperbolic tan of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet ptanh(const Packet& a) { EIGEN_USING_STD_MATH(tanh); return tanh(a); } +Packet ptanh(const Packet& a) { EIGEN_USING_STD(tanh); return tanh(a); } /** \internal \returns the exp of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pexp(const Packet& a) { EIGEN_USING_STD_MATH(exp); return exp(a); } +Packet pexp(const Packet& a) { EIGEN_USING_STD(exp); return exp(a); } /** \internal \returns the expm1 of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS @@ -618,7 +618,7 @@ Packet pexpm1(const Packet& a) { return numext::expm1(a); } /** \internal \returns the log of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet plog(const Packet& a) { EIGEN_USING_STD_MATH(log); return log(a); } +Packet plog(const Packet& a) { EIGEN_USING_STD(log); return log(a); } /** \internal \returns the log1p of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS @@ -626,11 +626,11 @@ Packet plog1p(const Packet& a) { return numext::log1p(a); } /** \internal \returns the log10 of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet plog10(const Packet& a) { EIGEN_USING_STD_MATH(log10); return log10(a); } +Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); } /** \internal \returns the square-root of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psqrt(const Packet& a) { EIGEN_USING_STD_MATH(sqrt); return sqrt(a); } +Packet psqrt(const Packet& a) { EIGEN_USING_STD(sqrt); return sqrt(a); } /** \internal \returns the reciprocal square-root of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index a727ea7ae..0b34ae923 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -335,7 +335,7 @@ struct norm1_default_impl<Scalar,true> EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - EIGEN_USING_STD_MATH(abs); + EIGEN_USING_STD(abs); return abs(x.real()) + abs(x.imag()); } }; @@ -346,7 +346,7 @@ struct norm1_default_impl<Scalar, false> EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - EIGEN_USING_STD_MATH(abs); + EIGEN_USING_STD(abs); return abs(x); } }; @@ -406,7 +406,7 @@ inline NewType cast(const OldType& x) static inline Scalar run(const Scalar& x) { EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) - EIGEN_USING_STD_MATH(round); + EIGEN_USING_STD(round); return Scalar(round(x)); } }; @@ -418,8 +418,8 @@ inline NewType cast(const OldType& x) static inline Scalar run(const Scalar& x) { EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) - EIGEN_USING_STD_MATH(floor); - EIGEN_USING_STD_MATH(ceil); + EIGEN_USING_STD(floor); + EIGEN_USING_STD(ceil); return (x > Scalar(0)) ? floor(x + Scalar(0.5)) : ceil(x - Scalar(0.5)); } }; @@ -442,7 +442,7 @@ struct rint_impl { { EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) #if EIGEN_HAS_CXX11_MATH - EIGEN_USING_STD_MATH(rint); + EIGEN_USING_STD(rint); #endif return rint(x); } @@ -487,7 +487,7 @@ struct rint_retval // HIP does not seem to have a native device side implementation for the math routine "arg" using std::arg; #else - EIGEN_USING_STD_MATH(arg); + EIGEN_USING_STD(arg); #endif return arg(x); } @@ -510,7 +510,7 @@ struct rint_retval EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - EIGEN_USING_STD_MATH(arg); + EIGEN_USING_STD(arg); return arg(x); } }; @@ -538,7 +538,7 @@ namespace std_fallback { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) typedef typename NumTraits<Scalar>::Real RealScalar; - EIGEN_USING_STD_MATH(exp); + EIGEN_USING_STD(exp); Scalar u = exp(x); if (numext::equal_strict(u, Scalar(1))) { return x; @@ -548,7 +548,7 @@ namespace std_fallback { return RealScalar(-1); } - EIGEN_USING_STD_MATH(log); + EIGEN_USING_STD(log); Scalar logu = log(u); return numext::equal_strict(u, logu) ? u : (u - RealScalar(1)) * x / logu; } @@ -589,7 +589,7 @@ struct expm1_impl<std::complex<RealScalar> > { // TODO better use numext::expm1 and numext::sin (but that would require forward declarations or moving this specialization down). RealScalar erm1 = expm1_impl<RealScalar>::run(xr); RealScalar er = erm1 + RealScalar(1.); - EIGEN_USING_STD_MATH(sin); + EIGEN_USING_STD(sin); RealScalar sin2 = sin(xi / RealScalar(2.)); sin2 = sin2 * sin2; RealScalar s = sin(xi); @@ -615,7 +615,7 @@ namespace std_fallback { EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) typedef typename NumTraits<Scalar>::Real RealScalar; - EIGEN_USING_STD_MATH(log); + EIGEN_USING_STD(log); Scalar x1p = RealScalar(1) + x; Scalar log_1p = log(x1p); const bool is_small = numext::equal_strict(x1p, Scalar(1)); @@ -665,7 +665,7 @@ struct pow_impl typedef typename ScalarBinaryOpTraits<ScalarX,ScalarY,internal::scalar_pow_op<ScalarX,ScalarY> >::ReturnType result_type; static EIGEN_DEVICE_FUNC inline result_type run(const ScalarX& x, const ScalarY& y) { - EIGEN_USING_STD_MATH(pow); + EIGEN_USING_STD(pow); return pow(x, y); } }; @@ -972,7 +972,7 @@ template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) { - EIGEN_USING_STD_MATH(min) + EIGEN_USING_STD(min) return min EIGEN_NOT_A_MACRO (x,y); } @@ -980,7 +980,7 @@ template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) { - EIGEN_USING_STD_MATH(max) + EIGEN_USING_STD(max) return max EIGEN_NOT_A_MACRO (x,y); } #else @@ -1289,7 +1289,7 @@ template<typename T> EIGEN_DEVICE_FUNC T (floor)(const T& x) { - EIGEN_USING_STD_MATH(floor) + EIGEN_USING_STD(floor) return floor(x); } @@ -1309,7 +1309,7 @@ template<typename T> EIGEN_DEVICE_FUNC T (ceil)(const T& x) { - EIGEN_USING_STD_MATH(ceil); + EIGEN_USING_STD(ceil); return ceil(x); } @@ -1354,7 +1354,7 @@ template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sqrt(const T &x) { - EIGEN_USING_STD_MATH(sqrt); + EIGEN_USING_STD(sqrt); return sqrt(x); } @@ -1365,7 +1365,7 @@ SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sqrt, sqrt) template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T log(const T &x) { - EIGEN_USING_STD_MATH(log); + EIGEN_USING_STD(log); return log(x); } @@ -1386,7 +1386,7 @@ template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE typename internal::enable_if<NumTraits<T>::IsSigned || NumTraits<T>::IsComplex,typename NumTraits<T>::Real>::type abs(const T &x) { - EIGEN_USING_STD_MATH(abs); + EIGEN_USING_STD(abs); return abs(x); } @@ -1423,7 +1423,7 @@ double abs(const std::complex<double>& x) { template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T exp(const T &x) { - EIGEN_USING_STD_MATH(exp); + EIGEN_USING_STD(exp); return exp(x); } @@ -1477,7 +1477,7 @@ double expm1(const double &x) { return ::expm1(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cos(const T &x) { - EIGEN_USING_STD_MATH(cos); + EIGEN_USING_STD(cos); return cos(x); } @@ -1496,7 +1496,7 @@ double cos(const double &x) { return ::cos(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sin(const T &x) { - EIGEN_USING_STD_MATH(sin); + EIGEN_USING_STD(sin); return sin(x); } @@ -1515,7 +1515,7 @@ double sin(const double &x) { return ::sin(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tan(const T &x) { - EIGEN_USING_STD_MATH(tan); + EIGEN_USING_STD(tan); return tan(x); } @@ -1534,7 +1534,7 @@ double tan(const double &x) { return ::tan(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T acos(const T &x) { - EIGEN_USING_STD_MATH(acos); + EIGEN_USING_STD(acos); return acos(x); } @@ -1542,7 +1542,7 @@ T acos(const T &x) { template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T acosh(const T &x) { - EIGEN_USING_STD_MATH(acosh); + EIGEN_USING_STD(acosh); return acosh(x); } #endif @@ -1563,7 +1563,7 @@ double acos(const double &x) { return ::acos(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T asin(const T &x) { - EIGEN_USING_STD_MATH(asin); + EIGEN_USING_STD(asin); return asin(x); } @@ -1571,7 +1571,7 @@ T asin(const T &x) { template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T asinh(const T &x) { - EIGEN_USING_STD_MATH(asinh); + EIGEN_USING_STD(asinh); return asinh(x); } #endif @@ -1592,7 +1592,7 @@ double asin(const double &x) { return ::asin(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T atan(const T &x) { - EIGEN_USING_STD_MATH(atan); + EIGEN_USING_STD(atan); return atan(x); } @@ -1600,7 +1600,7 @@ T atan(const T &x) { template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T atanh(const T &x) { - EIGEN_USING_STD_MATH(atanh); + EIGEN_USING_STD(atanh); return atanh(x); } #endif @@ -1622,7 +1622,7 @@ double atan(const double &x) { return ::atan(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cosh(const T &x) { - EIGEN_USING_STD_MATH(cosh); + EIGEN_USING_STD(cosh); return cosh(x); } @@ -1641,7 +1641,7 @@ double cosh(const double &x) { return ::cosh(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T sinh(const T &x) { - EIGEN_USING_STD_MATH(sinh); + EIGEN_USING_STD(sinh); return sinh(x); } @@ -1660,7 +1660,7 @@ double sinh(const double &x) { return ::sinh(x); } template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T tanh(const T &x) { - EIGEN_USING_STD_MATH(tanh); + EIGEN_USING_STD(tanh); return tanh(x); } @@ -1684,7 +1684,7 @@ double tanh(const double &x) { return ::tanh(x); } template <typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T fmod(const T& a, const T& b) { - EIGEN_USING_STD_MATH(fmod); + EIGEN_USING_STD(fmod); return fmod(a, b); } diff --git a/Eigen/src/Core/MathFunctionsImpl.h b/Eigen/src/Core/MathFunctionsImpl.h index 7af58fadb..8288ad834 100644 --- a/Eigen/src/Core/MathFunctionsImpl.h +++ b/Eigen/src/Core/MathFunctionsImpl.h @@ -79,7 +79,7 @@ template<typename RealScalar> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) { - EIGEN_USING_STD_MATH(sqrt); + EIGEN_USING_STD(sqrt); RealScalar p, qp; p = numext::maxi(x,y); if(p==RealScalar(0)) return RealScalar(0); @@ -94,7 +94,7 @@ struct hypot_impl static EIGEN_DEVICE_FUNC inline RealScalar run(const Scalar& x, const Scalar& y) { - EIGEN_USING_STD_MATH(abs); + EIGEN_USING_STD(abs); return positive_real_hypot<RealScalar>(abs(x), abs(y)); } }; diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index a9cbfd967..c7ed18c69 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h @@ -387,7 +387,7 @@ struct functor_traits<scalar_log1p_op<Scalar> > { */ template<typename Scalar> struct scalar_log10_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_log10_op) - EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { EIGEN_USING_STD_MATH(log10) return log10(a); } + EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { EIGEN_USING_STD(log10) return log10(a); } template <typename Packet> EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::plog10(a); } }; diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 243acc696..2d47c075c 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -1036,25 +1036,11 @@ namespace Eigen { // In host mode, and when device code is compiled with clang, // use the std versions. #if (defined(EIGEN_CUDA_ARCH) && defined(__NVCC__)) || defined(EIGEN_HIP_DEVICE_COMPILE) - #define EIGEN_USING_STD_MATH(FUNC) using ::FUNC; -#else - #define EIGEN_USING_STD_MATH(FUNC) using std::FUNC; -#endif - - -// When compiling HIP device code with HIPCC, certain functions -// from the stdlib need to be pulled in from the global namespace -// (as opposed to from the std:: namespace). This is because HIPCC -// does not natively support all the std:: routines in device code. -// Instead it contains header files that declare the corresponding -// routines in the global namespace such they can be used in device code. -#if defined(EIGEN_HIP_DEVICE_COMPILE) #define EIGEN_USING_STD(FUNC) using ::FUNC; #else #define EIGEN_USING_STD(FUNC) using std::FUNC; #endif - #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || EIGEN_COMP_NVCC) // for older MSVC versions, as well as 1900 && CUDA 8, using the base operator is sufficient (cf Bugs 1000, 1324) #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ |