File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
dpctl/tensor/libtensor/include/kernels/elementwise_functions Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 25
25
#pragma once
26
26
#include < CL/sycl.hpp>
27
27
#include < cmath>
28
+ #include < complex>
28
29
#include < cstddef>
29
30
#include < cstdint>
30
31
#include < type_traits>
@@ -72,9 +73,25 @@ template <typename argT, typename resT> struct AbsFunctor
72
73
return x;
73
74
}
74
75
else {
75
- return std::abs (x);
76
+ if constexpr (is_complex<argT>::value) {
77
+ return cabs (x);
78
+ }
79
+ else {
80
+ return std::abs (x);
81
+ }
76
82
}
77
83
}
84
+
85
+ private:
86
+ template <typename realT> realT cabs (std::complex<realT> const &z)
87
+ {
88
+ #ifdef _WINDOWS
89
+ // work-around for gh-1279
90
+ return std::hypot (std::real (z), std::imag (z));
91
+ #else
92
+ return std::abs (z);
93
+ #endif
94
+ }
78
95
};
79
96
80
97
template <typename argT,
You can’t perform that action at this time.
0 commit comments