aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Antonio Sanchez <cantonios@google.com>2021-05-06 19:49:49 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-05-07 18:14:00 +0000
commitc0eb5f89a406243f71eae0b705eba4437d9f8565 (patch)
tree2d978edbb1a00e3484aed2afd63d8a1d27957664 /Eigen
parent0eba8a1fe3e0fa78f0e6760c0e1265817491845d (diff)
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.
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Core/MathFunctions.h7
1 files changed, 4 insertions, 3 deletions
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<Scalar,true>
}
};
-template<typename Scalar> struct conj_impl : conj_default_impl<Scalar> {};
+template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
+struct conj_impl : conj_default_impl<Scalar, IsComplex> {};
#if defined(EIGEN_GPU_COMPILE_PHASE)
template<typename T>
-struct conj_impl<std::complex<T> >
+struct conj_impl<std::complex<T>, true>
{
EIGEN_DEVICE_FUNC
static inline std::complex<T> run(const std::complex<T>& x)
{
- return std::complex<T>(x.real(), -x.imag());
+ return std::complex<T>(numext::real(x), -numext::imag(x));
}
};
#endif