diff options
author | Gael Guennebaud <g.gael@free.fr> | 2019-10-08 09:15:17 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2019-10-08 09:15:17 +0200 |
commit | 87427d2eaa90bbc1c12eedecca95554d93c3c212 (patch) | |
tree | 80afa4fb6964154d46e42b877b2888122bbec70d /Eigen/src/Core/MathFunctions.h | |
parent | 7a43af1a335da2c0489b4119a33ee1cbff0c15d6 (diff) |
PR 719: fix real/imag namespace conflict
Diffstat (limited to 'Eigen/src/Core/MathFunctions.h')
-rw-r--r-- | Eigen/src/Core/MathFunctions.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index f1feab508..4e6053b2e 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -300,7 +300,7 @@ struct abs2_impl_default<Scalar, true> // IsComplex EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - return real(x)*real(x) + imag(x)*imag(x); + return x.real()*x.real() + x.imag()*x.imag(); } }; @@ -326,14 +326,17 @@ struct abs2_retval ****************************************************************************/ template<typename Scalar, bool IsComplex> -struct norm1_default_impl +struct norm1_default_impl; + +template<typename Scalar> +struct norm1_default_impl<Scalar,true> { typedef typename NumTraits<Scalar>::Real RealScalar; EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { EIGEN_USING_STD_MATH(abs); - return abs(real(x)) + abs(imag(x)); + return abs(x.real()) + abs(x.imag()); } }; @@ -753,8 +756,8 @@ struct random_default_impl<Scalar, true, false> { static inline Scalar run(const Scalar& x, const Scalar& y) { - return Scalar(random(real(x), real(y)), - random(imag(x), imag(y))); + return Scalar(random(x.real(), y.real()), + random(x.imag(), y.imag())); } static inline Scalar run() { |