fix complex reduce + nan propagation in min and max (#2377)

This commit is contained in:
Awni Hannun
2025-07-15 18:19:47 -07:00
committed by GitHub
parent 2ba69bc8fa
commit d7734edd9f
4 changed files with 30 additions and 10 deletions

View File

@@ -38,14 +38,13 @@ inline __host__ __device__ complex_t<T> operator%(
}
template <typename T>
inline __host__ __device__ bool operator<(complex_t<T> a, complex_t<T> b) {
return (a.real() * a.real() + a.imag() * a.imag()) <
(b.real() * b.real() + b.imag() * b.imag());
inline __host__ __device__ bool operator>(complex_t<T> a, complex_t<T> b) {
return (a.real() > b.real()) || (a.real() == b.real() && a.imag() > b.imag());
}
template <typename T>
inline __host__ __device__ bool operator>(complex_t<T> a, complex_t<T> b) {
return b < a;
inline __host__ __device__ bool operator<(complex_t<T> a, complex_t<T> b) {
return operator>(b, a);
}
template <typename T>