mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix MSVC complex sqrt and packetmath test.
MSVC incorrectly handles `inf` cases for `std::sqrt<std::complex<T>>`. Here we replace it with a custom version (currently used on GPU). Also fixed the `packetmath` test, which previously skipped several corner cases since `CHECK_CWISE1` only tests the first `PacketSize` elements.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
8d9cfba799
commit
f149e0ebc3
@@ -338,6 +338,22 @@ struct sqrt_impl
|
||||
}
|
||||
};
|
||||
|
||||
// Complex sqrt defined in MathFunctionsImpl.h.
|
||||
template<typename T> std::complex<T> complex_sqrt(const std::complex<T>& a_x);
|
||||
|
||||
// MSVC incorrectly handles inf cases.
|
||||
#if EIGEN_COMP_MSVC > 0
|
||||
template<typename T>
|
||||
struct sqrt_impl<std::complex<T> >
|
||||
{
|
||||
EIGEN_DEVICE_FUNC
|
||||
static EIGEN_ALWAYS_INLINE std::complex<T> run(const std::complex<T>& x)
|
||||
{
|
||||
return complex_sqrt<T>(x);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename Scalar>
|
||||
struct sqrt_retval
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user