File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
dpctl/tensor/libtensor/include/kernels/elementwise_functions Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -53,14 +53,16 @@ using dpctl::tensor::ssize_t;
53
53
namespace td_ns = dpctl::tensor::type_dispatch;
54
54
55
55
using dpctl::tensor::type_utils::is_complex;
56
+ using dpctl::tensor::type_utils::is_complex_v;
56
57
57
58
template <typename argT, typename resT> struct ImagFunctor
58
59
{
59
60
60
61
// is function constant for given argT
61
- using is_constant = typename std::false_type;
62
+ using is_constant =
63
+ typename std::is_same<is_complex<argT>, std::false_type>;
62
64
// constant value, if constant
63
- // constexpr resT constant_value = resT{};
65
+ static constexpr resT constant_value = resT{0 };
64
66
// is function defined for sycl::vec
65
67
using supports_vec = typename std::false_type;
66
68
// do both argTy and resTy support sugroup store/load operation
@@ -69,12 +71,12 @@ template <typename argT, typename resT> struct ImagFunctor
69
71
70
72
resT operator ()(const argT &in) const
71
73
{
72
- if constexpr (is_complex <argT>::value ) {
74
+ if constexpr (is_complex_v <argT>) {
73
75
return std::imag (in);
74
76
}
75
77
else {
76
78
static_assert (std::is_same_v<resT, argT>);
77
- return resT{ 0 } ;
79
+ return constant_value ;
78
80
}
79
81
}
80
82
};
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ using dpctl::tensor::ssize_t;
53
53
namespace td_ns = dpctl::tensor::type_dispatch;
54
54
55
55
using dpctl::tensor::type_utils::is_complex;
56
+ using dpctl::tensor::type_utils::is_complex_v;
56
57
57
58
template <typename argT, typename resT> struct RealFunctor
58
59
{
@@ -69,7 +70,7 @@ template <typename argT, typename resT> struct RealFunctor
69
70
70
71
resT operator ()(const argT &in) const
71
72
{
72
- if constexpr (is_complex <argT>::value ) {
73
+ if constexpr (is_complex_v <argT>) {
73
74
return std::real (in);
74
75
}
75
76
else {
You can’t perform that action at this time.
0 commit comments