16 #ifndef OPENKALMAN_TRANSPOSE_HPP 17 #define OPENKALMAN_TRANSPOSE_HPP 19 #include "patterns/patterns.hpp" 29 #include "linear-algebra/functions/internal/make_wrapped_mdspan.hpp" 42 template<std::
size_t indexa = 0, std::
size_t indexb = 1, indexible Arg> requires (indexa < indexb)
45 template<std::size_t indexa = 0, std::size_t indexb = 1,
typename Arg, std::enable_if_t<
46 indexible<Arg> and (indexa < indexb),
int> = 0>
47 constexpr decltype(
auto)
54 (constant_object<Arg> or
56 (diagonal_matrix<Arg> or
59 return std::forward<Arg>(arg);
61 else if constexpr (interface::transpose_defined_for<Arg&&, indexa, indexb>)
65 else if constexpr (constant_object<Arg>)
69 else if constexpr (hermitian_matrix<Arg>)
77 using nested_layout =
typename std::decay_t<decltype(n)>::layout_type;
78 using extents_type = std::decay_t<decltype(to_extents(p))>;
79 if constexpr (indexb == 1 and n.rank() == 2)
81 using layout_type = stdex::linalg::layout_transpose<nested_layout>;
82 using mapping_type =
typename layout_type::template mapping<extents_type>;
83 return internal::make_wrapped_mdspan(
84 std::forward<Arg>(arg),
86 mapping_type(n.mapping()),
92 using nested_mapping_type =
typename std::decay_t<decltype(n)>::mapping_type;
94 using mapping_type =
typename layout_type::template mapping<extents_type>;
95 return internal::make_wrapped_mdspan(
96 std::forward<Arg>(arg),
Definition for constant_value.
Definition: language-features.hpp:228
Definition for constant_object.
Definition: transpose_mdspan_policies.hpp:29
decltype(auto) constexpr conjugate(Arg &&arg)
Take the complex conjugate of an indexible object.
Definition: conjugate.hpp:44
constexpr bool compares_with
Compares two patterns::pattern objects.
Definition: compares_with.hpp:472
constexpr bool complex
T is a value that reduces to std::complex or a custom complex type.
Definition: complex.hpp:47
constexpr bool indexible
T is a multidimensional array type.
Definition: indexible.hpp:32
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the patterns::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:36
Definition for diagonal_matrix.
typename pattern_collection_element< i, T >::type pattern_collection_element_t
Helper template for collection_element.
Definition: pattern_collection_element.hpp:58
Definition for element_type_of.
The root namespace for OpenKalman.
Definition: basics.hpp:34
An interface to various routines from the linear algebra library associated with indexible object T...
Definition: library_interface.hpp:42
decltype(auto) constexpr transpose(Arg &&arg)
Swap any two indices of an indexible_object.
Definition: transpose.hpp:49
Definition of get_mdspan function.
constexpr auto make_constant(C c, P &&p)
Make an indexible object in which every element is a constant value.
Definition: make_constant.hpp:41
constexpr auto constant_value(T &&t)
The constant value associated with a constant_object or constant_diagonal_object. ...
Definition: constant_value.hpp:37
Definition of get_pattern_collection function.
Definition for hermitian_matrix.
Definition for indexible.
Definition of conjugate function.
typename element_type_of< T >::type element_type_of_t
helper template for element_type_of.
Definition: element_type_of.hpp:54
Definitions for make_constant.
constexpr auto to_extents(P &&p)
Convert a pattern_collection to std::extents.
Definition: to_extents.hpp:78
decltype(auto) constexpr get_mdspan(T &&t)
Get the mdspan associated with indexible object T.
Definition: get_mdspan.hpp:35