20
20
// ===---------------------------------------------------------------------===//
21
21
// /
22
22
// / \file
23
- // / This file defines kernels for elementwise evaluation of CONJ (x) function.
23
+ // / This file defines kernels for elementwise evaluation of PROJ (x) function.
24
24
// ===---------------------------------------------------------------------===//
25
25
26
26
#pragma once
29
29
#include < complex>
30
30
#include < cstddef>
31
31
#include < cstdint>
32
+ #include < limits>
32
33
#include < type_traits>
33
34
34
35
#include " kernels/elementwise_functions/common.hpp"
@@ -62,12 +63,19 @@ template <typename argT, typename resT> struct ProjFunctor
62
63
// is function defined for sycl::vec
63
64
using supports_vec = typename std::false_type;
64
65
// do both argTy and resTy support sugroup store/load operation
65
- using supports_sg_loadstore = typename std::negation<
66
- std::disjunction<is_complex<resT>, is_complex<argT>>>;
66
+ using supports_sg_loadstore = typename std::false_type;
67
67
68
68
resT operator ()(const argT &in)
69
69
{
70
- return std::proj (in);
70
+ using realT = typename argT::value_type;
71
+ const realT x = std::real (in);
72
+ const realT y = std::imag (in);
73
+
74
+ if (std::isinf (x) || std::isinf (y)) {
75
+ const realT res_im = std::copysign (0.0 , y);
76
+ return resT{std::numeric_limits<realT>::infinity (), res_im};
77
+ }
78
+ return in;
71
79
}
72
80
};
73
81
@@ -86,8 +94,6 @@ template <typename T> struct ProjOutputType
86
94
{
87
95
using value_type = typename std::disjunction< // disjunction is C++17
88
96
// feature, supported by DPC++
89
- td_ns::TypeMapResultEntry<T, float , std::complex<float >>,
90
- td_ns::TypeMapResultEntry<T, double , std::complex<double >>,
91
97
td_ns::TypeMapResultEntry<T, std::complex<float >>,
92
98
td_ns::TypeMapResultEntry<T, std::complex<double >>,
93
99
td_ns::DefaultResultEntry<void >>::result_type;
0 commit comments