4#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_LINALG_TRANSPOSED_HPP_
5#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_LINALG_TRANSPOSED_HPP_
11#include "arene/base/mdspan/detail/reverse_extents.hpp"
23namespace transposed_detail {
32template <
class InputExtents>
33class transpose_extents {
36 static_assert(InputExtents::rank() == 2U,
"transposed requires a rank-2 mdspan.");
41 using type = mdspan_detail::reverse_extents_t<InputExtents>;
46template <
class InputExtents>
47using transpose_extents_t =
typename transpose_extents<InputExtents>::type;
60 template <
class ElementType,
class InputExtents,
class AccessorPolicy>
61 constexpr auto operator()(mdspan<ElementType, InputExtents, layout_left, AccessorPolicy> matrix)
const noexcept
62 -> mdspan<ElementType, transpose_extents_t<InputExtents>, layout_right, AccessorPolicy> {
63 using transposed_extents_type = transpose_extents_t<InputExtents>;
64 using return_type = mdspan<ElementType, transposed_extents_type, layout_right, AccessorPolicy>;
67 typename return_type::mapping_type{transposed_extents_type{matrix.extent(1U), matrix.extent(0U)}},
79 template <
class ElementType,
class InputExtents,
class AccessorPolicy>
80 constexpr auto operator()(mdspan<ElementType, InputExtents, layout_right, AccessorPolicy> matrix)
const noexcept
81 -> mdspan<ElementType, transpose_extents_t<InputExtents>, layout_left, AccessorPolicy> {
82 using transposed_extents_type = transpose_extents_t<InputExtents>;
83 using return_type = mdspan<ElementType, transposed_extents_type, layout_left, AccessorPolicy>;
86 typename return_type::mapping_type{transposed_extents_type{matrix.extent(1U), matrix.extent(0U)}},
98 template <
class ElementType,
class InputExtents,
class AccessorPolicy>
99 constexpr auto operator()(mdspan<ElementType, InputExtents, layout_stride, AccessorPolicy> matrix)
const noexcept
100 -> mdspan<ElementType, transpose_extents_t<InputExtents>, layout_stride, AccessorPolicy> {
101 using transposed_extents_type = transpose_extents_t<InputExtents>;
102 using return_type = mdspan<ElementType, transposed_extents_type, layout_stride, AccessorPolicy>;
104 matrix.data_handle(),
105 typename return_type::mapping_type{
106 transposed_extents_type{matrix.extent(1U), matrix.extent(0U)},
107 array<typename InputExtents::index_type, 2U>{matrix.mapping().stride(1U), matrix.mapping().stride(0U)}
121 template <
class ElementType,
class InputExtents,
class NestedLayout,
class AccessorPolicy>
122 constexpr auto operator()(mdspan<ElementType, InputExtents, layout_transpose<NestedLayout>, AccessorPolicy> matrix
123 )
const noexcept -> mdspan<ElementType, transpose_extents_t<InputExtents>, NestedLayout, AccessorPolicy> {
124 using transposed_extents_type = transpose_extents_t<InputExtents>;
125 using return_type = mdspan<ElementType, transposed_extents_type, NestedLayout, AccessorPolicy>;
126 return return_type{matrix.data_handle(), matrix.mapping().nested_mapping(), matrix.accessor()};
137 template <
class ElementType,
class InputExtents,
class InputLayout,
class AccessorPolicy>
138 constexpr auto operator()(mdspan<ElementType, InputExtents, InputLayout, AccessorPolicy> matrix)
const noexcept
139 -> mdspan<ElementType, transpose_extents_t<InputExtents>, layout_transpose<InputLayout>, AccessorPolicy> {
140 using transposed_extents_type = transpose_extents_t<InputExtents>;
141 using return_type = mdspan<ElementType, transposed_extents_type, layout_transpose<InputLayout>, AccessorPolicy>;
142 return return_type{matrix.data_handle(),
typename return_type::mapping_type{matrix.mapping()}, matrix.accessor()};
#define ARENE_CPP14_INLINE_VARIABLE(type, name)
Emulates C++17's inline variable declarations for function objects.
Definition cpp14_inline.hpp:69
Definition accumulate.hpp:37
Definition accumulate.hpp:36