Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ using dpctl::tensor::ssize_t;
namespace td_ns = dpctl::tensor::type_dispatch;

using dpctl::tensor::type_utils::is_complex;
using dpctl::tensor::type_utils::is_complex_v;

template <typename argT, typename resT> struct ImagFunctor
{

// is function constant for given argT
using is_constant = typename std::false_type;
using is_constant =
typename std::is_same<is_complex<argT>, std::false_type>;
// constant value, if constant
// constexpr resT constant_value = resT{};
static constexpr resT constant_value = resT{0};
// is function defined for sycl::vec
using supports_vec = typename std::false_type;
// do both argTy and resTy support sugroup store/load operation
Expand All @@ -69,12 +71,12 @@ template <typename argT, typename resT> struct ImagFunctor

resT operator()(const argT &in) const
{
if constexpr (is_complex<argT>::value) {
if constexpr (is_complex_v<argT>) {
return std::imag(in);
}
else {
static_assert(std::is_same_v<resT, argT>);
return resT{0};
return constant_value;
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ using dpctl::tensor::ssize_t;
namespace td_ns = dpctl::tensor::type_dispatch;

using dpctl::tensor::type_utils::is_complex;
using dpctl::tensor::type_utils::is_complex_v;

template <typename argT, typename resT> struct RealFunctor
{
Expand All @@ -69,7 +70,7 @@ template <typename argT, typename resT> struct RealFunctor

resT operator()(const argT &in) const
{
if constexpr (is_complex<argT>::value) {
if constexpr (is_complex_v<argT>) {
return std::real(in);
}
else {
Expand Down
Loading