File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
dpctl/tensor/libtensor/include/kernels/elementwise_functions Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -65,17 +65,28 @@ template <typename argT, typename resT> struct ProjFunctor
65
65
// do both argTy and resTy support sugroup store/load operation
66
66
using supports_sg_loadstore = typename std::false_type;
67
67
68
- resT operator ()(const argT &in)
68
+ resT operator ()(const argT &in) const
69
69
{
70
70
using realT = typename argT::value_type;
71
71
const realT x = std::real (in);
72
72
const realT y = std::imag (in);
73
73
74
- if (std::isinf (x) || std::isinf (y)) {
75
- const realT res_im = std::copysign (realT (0 ), y);
76
- return resT{std::numeric_limits<realT>::infinity (), res_im};
74
+ if (std::isinf (x)) {
75
+ return value_at_infinity (y);
77
76
}
78
- return in;
77
+ else if (std::isinf (y)) {
78
+ return value_at_infinity (y);
79
+ }
80
+ else {
81
+ return in;
82
+ }
83
+ }
84
+
85
+ private:
86
+ template <typename T> std::complex<T> value_at_infinity (const T &y) const
87
+ {
88
+ const T res_im = std::copysign (T (0 ), y);
89
+ return std::complex<T>{std::numeric_limits<T>::infinity (), res_im};
79
90
}
80
91
};
81
92
You can’t perform that action at this time.
0 commit comments