From c0eb5f89a406243f71eae0b705eba4437d9f8565 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Thu, 6 May 2021 19:49:49 -0700 Subject: Restore ABI compatibility for conj with 3.3, fix conflict with boost. The boost library unfortunately specializes `conj` for various types and assumes the original two-template-parameter version. This changes restores the second parameter. This also restores ABI compatibility. The specialization for `std::complex` is because `std::conj` is not a device function. For custom complex scalar types, users should provide their own `conj` implementation. We may consider removing the unnecessary second parameter in the future - but this will require modifying boost as well. Fixes #2112. --- Eigen/src/Core/MathFunctions.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Eigen') diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 67b1d8263..f77724052 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -260,16 +260,17 @@ struct conj_default_impl } }; -template struct conj_impl : conj_default_impl {}; +template::IsComplex> +struct conj_impl : conj_default_impl {}; #if defined(EIGEN_GPU_COMPILE_PHASE) template -struct conj_impl > +struct conj_impl, true> { EIGEN_DEVICE_FUNC static inline std::complex run(const std::complex& x) { - return std::complex(x.real(), -x.imag()); + return std::complex(numext::real(x), -numext::imag(x)); } }; #endif -- cgit v1.2.3