17 #ifndef OPENKALMAN_TRANSPOSE_MDSPAN_POLICIES_HPP 18 #define OPENKALMAN_TRANSPOSE_MDSPAN_POLICIES_HPP 28 template<
typename NestedMapping, std::
size_t indexa, std::
size_t indexb>
34 using extents_type = E;
35 using index_type =
typename extents_type::index_type;
36 using size_type =
typename extents_type::size_type;
37 using rank_type =
typename extents_type::rank_type;
42 template<std::size_t...i,
typename...Ix>
46 constexpr std::size_t N =
sizeof...(Ix);
47 if constexpr (
sizeof...(i) > N)
49 return access_with_indices_adjusted(seq, std::move(ix)..., 0_uz);
54 i == indexa and indexb < N ? indexb :
55 i == indexb and indexa < N ? indexa : i>(
56 std::forward_as_tuple(std::move(ix)...))...);
63 mapping(
const NestedMapping& map,
const extents_type& e) : nested_mapping_(map), extents_(e) {}
65 constexpr
const extents_type&
66 extents()
const noexcept {
return extents_; }
69 template<std::convertible_to<index_type>...IndexTypes> requires (
sizeof...(IndexTypes) == extents_type::rank())
71 template<
typename...IndexTypes, std::enable_if_t<
72 (... and std::is_convertible_v<IndexTypes, index_type>) and
73 (
sizeof...(IndexTypes) == extents_type::rank()),
int> = 0>
76 operator() (IndexTypes...i)
const 78 constexpr std::size_t rank = NestedMapping::extents_type::rank();
79 return access_with_indices_adjusted(std::make_index_sequence<rank>{}, std::move(i)...);
83 required_span_size()
const noexcept(noexcept(nested_mapping_.required_span_size()))
85 return nested_mapping_.required_span_size();
89 nested_mapping()
const {
return nested_mapping_; }
92 is_always_unique() noexcept {
return NestedMapping::is_always_unique(); }
95 is_always_exhaustive() noexcept {
return NestedMapping::is_always_contiguous(); }
98 is_always_strided() noexcept {
return NestedMapping::is_always_strided(); }
101 is_unique()
const {
return nested_mapping_.is_unique(); }
104 is_exhaustive()
const {
return nested_mapping_.is_exhaustive(); }
107 is_strided()
const {
return nested_mapping_.is_strided(); }
110 stride(
size_t r)
const 112 assert(this->is_strided());
113 assert(r < extents_type::rank());
114 return nested_mapping_.stride(r == indexa ? indexb : r == indexb ? indexa : r);
117 template<
class OtherExtents>
118 friend constexpr
bool 121 return lhs.nested_mapping_ == rhs.nested_mapping_;
126 NestedMapping nested_mapping_;
127 extents_type extents_;
constexpr detail_get::get_impl< i > get
A generalization of std::get, where the index is known at compile time.
Definition: get.hpp:50
Definition: basics.hpp:41
Definition: transpose_mdspan_policies.hpp:29
Definition: trait_backports.hpp:64
Basic definitions for OpenKalman as a whole.
Definition: transpose_mdspan_policies.hpp:32