From 87427d2eaa90bbc1c12eedecca95554d93c3c212 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 8 Oct 2019 09:15:17 +0200 Subject: PR 719: fix real/imag namespace conflict --- Eigen/src/Core/MathFunctions.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Eigen/src/Core/MathFunctions.h') 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 // 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 -struct norm1_default_impl +struct norm1_default_impl; + +template +struct norm1_default_impl { typedef typename NumTraits::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 { 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() { -- cgit v1.2.3