Commit adb7749 1 parent dc4da23 commit adb7749 Copy full SHA for adb7749
File tree 2 files changed +11
-13
lines changed
2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -78,37 +78,35 @@ template <typename T>
78
78
concept has_adl_imag = linalg_adl_checks::has_imag<T>;
79
79
80
80
inline constexpr auto abs_if_needed = []<typename T>(T const & val) {
81
- if constexpr (has_adl_abs<T>) {
82
- using etl::abs ;
81
+ if constexpr (unsigned_integral<T>) {
82
+ return val;
83
+ } else if constexpr (is_arithmetic_v<T>) {
84
+ return etl::abs (val);
85
+ } else if constexpr (has_adl_abs<T>) {
83
86
return abs (val);
84
87
} else {
85
- return val ;
88
+ static_assert (always_false<T>) ;
86
89
}
87
90
};
88
91
89
92
inline constexpr auto conj_if_needed = []<typename T>(T const & val) {
90
- if constexpr (has_adl_conj<T>) {
91
- using etl::conj;
93
+ if constexpr (not is_arithmetic_v<T> and has_adl_conj<T>) {
92
94
return conj (val);
93
95
} else {
94
96
return val;
95
97
}
96
98
};
97
99
98
100
inline constexpr auto real_if_needed = []<typename T>(T const & val) {
99
- if constexpr (has_adl_real<T>) {
100
- using etl::real;
101
+ if constexpr (not is_arithmetic_v<T> and has_adl_real<T>) {
101
102
return real (val);
102
103
} else {
103
104
return val;
104
105
}
105
106
};
106
107
107
108
inline constexpr auto imag_if_needed = []<typename T>(T const & val) {
108
- if constexpr (is_arithmetic_v<T>) {
109
- return val;
110
- } else if constexpr (has_adl_imag<T>) {
111
- using etl::imag;
109
+ if constexpr (not is_arithmetic_v<T> and has_adl_imag<T>) {
112
110
return imag (val);
113
111
} else {
114
112
return T{};
Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ template <typename IndexType>
84
84
CHECK (test_linalg_vector_idx_abs_max_real<unsigned long , IndexType>());
85
85
CHECK (test_linalg_vector_idx_abs_max_real<unsigned long long , IndexType>());
86
86
87
- // CHECK(test_linalg_vector_idx_abs_max_real<signed char, IndexType>());
88
- // CHECK(test_linalg_vector_idx_abs_max_real<signed short, IndexType>());
87
+ CHECK (test_linalg_vector_idx_abs_max_real<signed char , IndexType>());
88
+ CHECK (test_linalg_vector_idx_abs_max_real<signed short , IndexType>());
89
89
CHECK (test_linalg_vector_idx_abs_max_real<signed int , IndexType>());
90
90
CHECK (test_linalg_vector_idx_abs_max_real<signed long , IndexType>());
91
91
CHECK (test_linalg_vector_idx_abs_max_real<signed long long , IndexType>());
You can’t perform that action at this time.
0 commit comments