4#ifndef TETL_LINALG_CONCEPTS_HPP
5#define TETL_LINALG_CONCEPTS_HPP
7#include <etl/_complex/abs.hpp>
8#include <etl/_complex/complex.hpp>
9#include <etl/_complex/conj.hpp>
10#include <etl/_complex/imag.hpp>
11#include <etl/_complex/real.hpp>
12#include <etl/_concepts/same_as.hpp>
13#include <etl/_concepts/unsigned_integral.hpp>
14#include <etl/_math/abs.hpp>
15#include <etl/_mdspan/layout.hpp>
16#include <etl/_mdspan/layout_left.hpp>
17#include <etl/_mdspan/layout_right.hpp>
18#include <etl/_mdspan/mdspan.hpp>
19#include <etl/_numeric/abs.hpp>
20#include <etl/_type_traits/always_false.hpp>
21#include <etl/_type_traits/bool_constant.hpp>
22#include <etl/_type_traits/common_type.hpp>
23#include <etl/_type_traits/declval.hpp>
24#include <etl/_type_traits/is_arithmetic.hpp>
25#include <etl/_type_traits/is_same.hpp>
26#include <etl/_type_traits/remove_const.hpp>
31struct is_mdspan : false_type { };
33template <
typename T,
typename Extents,
typename Layout,
typename Accessor>
34struct is_mdspan<
mdspan<T, Extents, Layout, Accessor>> : true_type { };
36template <
typename... Ts>
37using common_size_type_t = common_type_t<
typename Ts::size_type...>;
39namespace linalg_adl_checks {
47auto abs(T
const&) -> T =
delete;
49auto conj(T
const&) -> T =
delete;
51auto real(T
const&) -> T =
delete;
53auto imag(T
const&) -> T =
delete;
56concept has_abs =
requires { abs(declval<T>()); };
59concept has_conj =
requires { conj(declval<T>()); };
62concept has_real =
requires { real(declval<T>()); };
65concept has_imag =
requires { imag(declval<T>()); };
70concept has_adl_abs = linalg_adl_checks::has_abs<T>;
73concept has_adl_conj = linalg_adl_checks::has_conj<T>;
76concept has_adl_real = linalg_adl_checks::has_real<T>;
79concept has_adl_imag = linalg_adl_checks::has_imag<T>;
81inline constexpr auto abs_if_needed = []<
typename T>(T
const& val) {
82 if constexpr (unsigned_integral<T>) {
84 }
else if constexpr (is_arithmetic_v<T>) {
86 }
else if constexpr (has_adl_abs<T>) {
89 static_assert(always_false<T>);
93inline constexpr auto conj_if_needed = []<
typename T>(T
const& val) {
94 if constexpr (
not is_arithmetic_v<T>
and has_adl_conj<T>) {
101inline constexpr auto real_if_needed = []<
typename T>(T
const& val) {
102 if constexpr (
not is_arithmetic_v<T>
and has_adl_real<T>) {
109inline constexpr auto imag_if_needed = []<
typename T>(T
const& val) {
110 if constexpr (
not is_arithmetic_v<T>
and has_adl_imag<T>) {
123concept in_vector = detail::is_mdspan<T>::value && T::rank() == 1;
127concept out_vector = detail::is_mdspan<T>::value
129 && same_as<remove_const_t<
typename T::element_type>,
typename T::element_type>
130 && T::is_always_unique();
134concept inout_vector = detail::is_mdspan<T>::value
136 && same_as<remove_const_t<
typename T::element_type>,
typename T::element_type>
137 && T::is_always_unique();
141concept in_matrix = detail::is_mdspan<T>::value && T::rank() == 2;
145concept out_matrix = detail::is_mdspan<T>::value
147 && is_same_v<remove_const_t<
typename T::element_type>,
typename T::element_type>
148 && T::is_always_unique();
152concept inout_matrix = detail::is_mdspan<T>::value
154 && is_same_v<remove_const_t<
typename T::element_type>,
typename T::element_type>
155 && T::is_always_unique();
167concept in_object = detail::is_mdspan<T>::value && (T::rank() == 1 || T::rank() == 2);
171concept out_object = detail::is_mdspan<T>::value
172 && (T::rank() == 1 || T::rank() == 2)
173 && is_same_v<remove_const_t<
typename T::element_type>,
typename T::element_type>
174 && T::is_always_unique();
178concept inout_object = detail::is_mdspan<T>::value
179 && (T::rank() == 1 || T::rank() == 2)
180 && is_same_v<remove_const_t<
typename T::element_type>,
typename T::element_type>
181 && T::is_always_unique();
Definition accessor_conjugate.hpp:13
Definition adjacent_find.hpp:9