File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed
dpctl/tensor/libtensor/include/kernels/elementwise_functions Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -57,21 +57,16 @@ template <typename realT> realT cabs(std::complex<realT> const &z)
57
57
constexpr realT q_nan = std::numeric_limits<realT>::quiet_NaN ();
58
58
constexpr realT p_inf = std::numeric_limits<realT>::infinity ();
59
59
60
- if (std::isinf (x)) {
61
- return p_inf;
62
- }
63
- else if (std::isinf (y)) {
64
- return p_inf;
65
- }
66
- else if (std::isnan (x)) {
67
- return q_nan;
68
- }
69
- else if (std::isnan (y)) {
70
- return q_nan;
71
- }
72
- else {
73
- return exprm_ns::abs (exprm_ns::complex<realT>(z));
74
- }
60
+ const realT res =
61
+ std::isinf (x)
62
+ ? p_inf
63
+ : ((std::isinf (y)
64
+ ? p_inf
65
+ : ((std::isnan (x)
66
+ ? q_nan
67
+ : exprm_ns::abs (exprm_ns::complex<realT>(z))))));
68
+
69
+ return res;
75
70
}
76
71
77
72
} // namespace detail
You can’t perform that action at this time.
0 commit comments