Update thrust::complex headers with a bug fix#2741
Conversation
|
Regarding the |
|
You may be surprised, but it's needed in supporting external libraries like CUB. (The compilation just wouldn't pass without |
| template <typename ValueType> | ||
| __host__ __device__ inline bool operator>(const complex<ValueType>& lhs, | ||
| const complex<ValueType>& rhs) { | ||
| if (lhs == rhs) | ||
| { | ||
| template <typename T> | ||
| __host__ __device__ inline bool operator>(const complex<T>& lhs, | ||
| const complex<T>& rhs) { | ||
| if (lhs == rhs) { | ||
| return false; | ||
| } else if (lhs.real() > rhs.real()) { | ||
| return true; | ||
| } else if (lhs.real() == rhs.real()) { | ||
| return lhs.imag() > rhs.imag(); | ||
| } else { | ||
| return false; | ||
| } else | ||
| { | ||
| return !(lhs < rhs); |
There was a problem hiding this comment.
This change in 655c8e3 fixed a bug:
>>> import cupy as cp
>>> a = cp.asarray([cp.complex(cp.nan, 0.9), cp.complex(0.7, cp.nan)])
>>> a[0] < a[1] # correct
array(False)
>>> a[0] > a[1] # wrong, should be False to match NumPy
array(True)
😂awesome. No problem with keeping these then. |
|
@emcastillo PTAL. |
|
Jenkins, test this please |
|
Successfully created a job for commit 655c8e3: |
|
Jenkins CI test (for commit 655c8e3, target branch master) succeeded! |
Update thrust::complex headers with a bug fix
Closes #2629. Changes (see the discussion starting #2629 (comment)):
__host__qualifier to all functions