3#ifndef TETL_LINALG_CONCEPTS_HPP
4#define TETL_LINALG_CONCEPTS_HPP
27namespace etl::linalg::detail {
32template <
typename T,
typename Extents,
typename Layout,
typename Accessor>
35template <
typename... Ts>
36using common_size_type_t =
common_type_t<
typename Ts::size_type...>;
38namespace linalg_adl_checks {
46auto abs(T
const&) -> T =
delete;
48auto conj(T
const&) -> T =
delete;
50auto real(T
const&) -> T =
delete;
52auto imag(T
const&) -> T =
delete;
55concept has_abs =
requires { abs(
declval<T>()); };
58concept has_conj =
requires { conj(
declval<T>()); };
61concept has_real =
requires { real(
declval<T>()); };
64concept has_imag =
requires { imag(
declval<T>()); };
69concept has_adl_abs = linalg_adl_checks::has_abs<T>;
72concept has_adl_conj = linalg_adl_checks::has_conj<T>;
75concept has_adl_real = linalg_adl_checks::has_real<T>;
78concept has_adl_imag = linalg_adl_checks::has_imag<T>;
80inline constexpr auto abs_if_needed = []<
typename T>(T
const&
val) {
81 if constexpr (unsigned_integral<T>) {
85 }
else if constexpr (has_adl_abs<T>) {
92inline constexpr auto conj_if_needed = []<
typename T>(T
const&
val) {
100inline constexpr auto real_if_needed = []<
typename T>(T
const&
val) {
108inline constexpr auto imag_if_needed = []<
typename T>(T
const&
val) {
Definition concepts.hpp:138
Definition concepts.hpp:162
Definition concepts.hpp:122
Definition concepts.hpp:149
Definition concepts.hpp:173
Definition concepts.hpp:133
Definition concepts.hpp:143
Definition concepts.hpp:167
Definition concepts.hpp:127
The concept same_as<T, U> is satisfied if and only if T and U denote the same type....
Definition same_as.hpp:19
constexpr auto real(complex< T > const &z) noexcept(noexcept(z.real())) -> T
Definition real.hpp:14
constexpr auto imag(complex< T > const &z) noexcept(noexcept(z.imag())) -> T
Definition imag.hpp:14
constexpr auto abs(complex< T > const &z) -> T
Definition abs.hpp:13
constexpr auto conj(complex< T > const &z) noexcept -> complex< T >
Definition conj.hpp:14
auto val(pin_number pin) -> etl::uint16_t
Definition gpio.hpp:37
Definition accessor_conjugate.hpp:12
mdspan(CArray &) -> mdspan< remove_all_extents_t< CArray >, extents< size_t, extent_v< CArray, 0 > > >
auto declval() noexcept -> add_rvalue_reference_t< T >
typename remove_const< T >::type remove_const_t
Definition remove_const.hpp:23
constexpr bool always_false
Definition always_false.hpp:9
bool_constant< true > true_type
Definition bool_constant.hpp:13
constexpr bool is_same_v
Definition is_same.hpp:11
constexpr bool is_arithmetic_v
Definition is_arithmetic.hpp:21
typename common_type< T... >::type common_type_t
Definition common_type.hpp:50
bool_constant< false > false_type
Definition bool_constant.hpp:14
static constexpr bool value
Definition integral_constant.hpp:10