Created attachment 668 [details] Possible fix for the problem mentioned above. I am trying to write a program that uses a C++ wrappers around mpfr_t as complex and real types. While compiling, I got into trouble with the following code from Eigen/src/Core/MathFunctions.h. template<typename Scalar> struct abs2_impl { typedef typename NumTraits<Scalar>::Real RealScalar; static inline RealScalar run(const Scalar& x) { return x*x; } }; The compiler tries to instantiate the function run() for a complex type. The multiplication operator * for the complex type returns a complex value, not a real scalar as required. I think the intent here was to return real(x) * real(x) + imag(x) + imag(x). This also agrees with the name of the function.
Well, your suggestion is not good, since it could create overhead for real-valued abs2 calls. I backported the implementation from the devel-branch to 3.2: https://bitbucket.org/eigen/eigen/commits/60d16ce411ff5b7
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1182.