mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 21:26:00 +08:00
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. (cherry picked from commit c0eb5f89a406243f71eae0b705eba4437d9f8565)
This commit is contained in:
parent
25424f4cf1
commit
2947c0cc84
@ -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)
|
#if defined(EIGEN_GPU_COMPILE_PHASE)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct conj_impl<std::complex<T> >
|
struct conj_impl<std::complex<T>, true>
|
||||||
{
|
{
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline std::complex<T> run(const std::complex<T>& x)
|
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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user