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
6565 // do both argTy and resTy support sugroup store/load operation
6666 using supports_sg_loadstore = typename std::false_type;
6767
68- resT operator ()(const argT &in)
68+ resT operator ()(const argT &in) const
6969 {
7070 using realT = typename argT::value_type;
7171 const realT x = std::real (in);
7272 const realT y = std::imag (in);
7373
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);
7776 }
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};
7990 }
8091};
8192
You can’t perform that action at this time.
0 commit comments