Repository navigation
Conversation
There are some notable differences though. thrust::complex has been a bit more lenient when determining the type of arithmetic operations. That said, I believe being more strict is actually a feature not a bug
| return __os << __s.str(); | ||
| } | ||
| #endif // !_LIBCUDACXX_HAS_NO_LOCALIZATION | ||
| #else // ^^^ !__cuda_std__ ^^^ / vvv __cuda_std__ |
There was a problem hiding this comment.
Those changes might be controversial as we are pulling in quite some machinery. Thoughts?
thrust::complex with std::complexthrust::complex with cuda::std::complex
gevtushenko
left a comment
There was a problem hiding this comment.
I've left a few comments on places that break API. I haven't covered all the changes, but I think that the comments should be applicable to the rest of them.
| template <typename T0, typename T1> | ||
| __host__ __device__ | ||
| complex<typename detail::promoted_numerical_type<T0, T1>::type> | ||
| operator-(const complex<T0>& x, const complex<T1>& y) | ||
| { | ||
| typedef typename detail::promoted_numerical_type<T0, T1>::type T; | ||
| return complex<T>(x.real() - y.real(), x.imag() - y.imag()); | ||
| } |
There was a problem hiding this comment.
The following code used to work, but now it doesn't:
thrust::complex<float> a;
thrust::complex<double> b;
auto c = a + b;I think we need to keep this overload and maybe mark it as deprecated. Same with other operators.
| template <typename T0, typename T1> | ||
| __host__ __device__ | ||
| complex<typename detail::promoted_numerical_type<T0, T1>::type> | ||
| operator+(const T0& x, const complex<T1>& y) | ||
| { | ||
| typedef typename detail::promoted_numerical_type<T0, T1>::type T; | ||
| return complex<T>(x + y.real(), y.imag()); | ||
| } |
There was a problem hiding this comment.
The following code used to work, but now it doesn't:
float a = 84;
thrust::complex<double> b(42, 42);
auto c = a + b;I think we need to keep this overload and maybe mark it as deprecated. Same with other operators.
| // As std::hypot is only C++11 we have to use the C interface | ||
| template <typename T> | ||
| __host__ __device__ | ||
| T abs(const complex<T>& z) |
There was a problem hiding this comment.
The following code used to work, now it doesn't:
thrust::complex<double> a;
auto b = thrust::abs(a);|
|
||
| template <typename T> | ||
| __host__ __device__ | ||
| T arg(const complex<T>& z) |
There was a problem hiding this comment.
The following code used to work, now it doesn't:
thrust::complex<double> a;
auto b = thrust::arg(a);|
Dropping in favor of #454 |
There are some notable differences though. thrust::complex has been a
bit more lenient when determining the type of arithmetic operations.
That said, I believe being more strict is actually a feature not a bug