Calls x.imag() instead of imag(x) when x is a complex number since the former

is a constexpr while the later isn't. This fixes compilation errors triggered by nvcc on Mac.
This commit is contained in:
Benoit Steiner 2016-09-22 13:17:25 -07:00
parent 8bde7da086
commit 50e3bbfc90

View File

@ -1049,12 +1049,12 @@ double abs(const double &x) { return ::fabs(x); }
template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
float abs(const std::complex<float>& x) {
return ::hypotf(real(x), imag(x));
return ::hypotf(x.real(), x.imag());
}
template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
double abs(const std::complex<double>& x) {
return ::hypot(real(x), imag(x));
return ::hypot(x.real(), x.imag());
}
#endif