Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents > Class Template Reference

The mapping type produced by layout_transpose for a given set of extents. More...

Inheritance diagram for arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >:
Inheritance graph

Public Types

using extents_type = Extents
 This mapping's extents type.
 
using index_type = typename extents_type::index_type
 The index type of this mapping.
 
using layout_type = layout_transpose
 The tag type of the layout used by this mapping.
 
using nested_mapping_type = typename NestedLayout::template mapping<mdspan_detail::reverse_extents_t<extents_type>>
 The wrapped (un-transposed) mapping type.
 
using rank_type = typename extents_type::rank_type
 The rank type of this mapping.
 
using size_type = typename extents_type::size_type
 The size type of this mapping.
 

Public Member Functions

constexpr mapping (nested_mapping_type const &nested) noexcept
 Construct a transposed mapping from a nested mapping.
 
constexpr auto extents () const noexcept -> extents_type const &
 Obtain the (transposed) extents of this mapping.
 
constexpr auto is_exhaustive () const noexcept -> bool
 Determine if this mapping is exhaustive.
 
constexpr auto is_strided () const noexcept -> bool
 Determine if this mapping is strided.
 
constexpr auto is_unique () const noexcept -> bool
 Determine if this mapping is unique.
 
constexpr auto nested_mapping () const noexcept -> nested_mapping_type const &
 Obtain the wrapped (un-transposed) mapping.
 
template<class Index0, class Index1>
constexpr auto operator() (Index0 index0, Index1 index1) const noexcept -> index_type
 Access the flat element index for the given two-dimensional index.
 
constexpr auto required_span_size () const noexcept -> index_type
 Obtain the required span size.
 
constexpr auto stride (rank_type rank_index) const noexcept -> index_type
 Obtain the stride along the specified (transposed) dimension.
 

Static Public Member Functions

static constexpr auto is_always_exhaustive () noexcept -> bool
 Determine if this mapping is always exhaustive.
 
static constexpr auto is_always_strided () noexcept -> bool
 Determine if this mapping is always strided.
 
static constexpr auto is_always_unique () noexcept -> bool
 Determine if this mapping is always unique.
 

Friends

template<class OtherExtents, std::enable_if_t< is_equality_comparable_v< nested_mapping_type, typename mapping< OtherExtents >::nested_mapping_type > &&extents_type::rank()==OtherExtents::rank(), bool > = true>
constexpr auto operator!= (mapping const left, mapping< OtherExtents > const right) noexcept -> bool
 Compare two transposed mappings for inequality.
 
template<class OtherExtents, std::enable_if_t< is_equality_comparable_v< nested_mapping_type, typename mapping< OtherExtents >::nested_mapping_type > &&extents_type::rank()==OtherExtents::rank(), bool > = true>
constexpr auto operator== (mapping const left, mapping< OtherExtents > const right) noexcept -> bool
 Compare two transposed mappings for equality.
 
template<class CanonicalSlice0, class CanonicalSlice1, class Mapping = mapping>
constexpr auto submdspan_mapping (mapping const src, CanonicalSlice0 slice0, CanonicalSlice1 slice1) noexcept(noexcept(transpose_result(mdspan_detail::do_submdspan_mapping(std::declval< Mapping const & >().nested_mapping(), std::move(std::declval< CanonicalSlice1 >()), std::move(std::declval< CanonicalSlice0 >()))))) ->
 Compute the sub-mapping and offset for a transposed mapping.
 

Detailed Description

template<class NestedLayout>
template<class Extents>
class arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >

The mapping type produced by layout_transpose for a given set of extents.

Template Parameters
Theextents of the space used for this mapping
Note
Mandates

Member Typedef Documentation

◆ extents_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::extents_type = Extents

This mapping's extents type.

◆ index_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::index_type = typename extents_type::index_type

The index type of this mapping.

◆ layout_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::layout_type = layout_transpose

The tag type of the layout used by this mapping.

◆ nested_mapping_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::nested_mapping_type = typename NestedLayout::template mapping<mdspan_detail::reverse_extents_t<extents_type>>

The wrapped (un-transposed) mapping type.

◆ rank_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::rank_type = typename extents_type::rank_type

The rank type of this mapping.

◆ size_type

template<class NestedLayout>
template<class Extents>
using arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::size_type = typename extents_type::size_type

The size type of this mapping.

Constructor & Destructor Documentation

◆ mapping()

template<class NestedLayout>
template<class Extents>
arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::mapping ( nested_mapping_type const & nested)
inlineexplicitconstexprnoexcept

Construct a transposed mapping from a nested mapping.

Parameters
nestedThe nested mapping to transpose

Member Function Documentation

◆ extents()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::extents ( ) const -> extents_type const&
inlineconstexprnoexcept

Obtain the (transposed) extents of this mapping.

Returns
The extents, with the two dimensions of the nested mapping swapped

◆ is_always_exhaustive()

template<class NestedLayout>
template<class Extents>
static constexpr auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_always_exhaustive ( ) -> bool
inlinestaticconstexprnoexcept

Determine if this mapping is always exhaustive.

Returns
nested_mapping_type::is_always_exhaustive()

◆ is_always_strided()

template<class NestedLayout>
template<class Extents>
static constexpr auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_always_strided ( ) -> bool
inlinestaticconstexprnoexcept

Determine if this mapping is always strided.

Returns
nested_mapping_type::is_always_strided()

◆ is_always_unique()

template<class NestedLayout>
template<class Extents>
static constexpr auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_always_unique ( ) -> bool
inlinestaticconstexprnoexcept

Determine if this mapping is always unique.

Returns
nested_mapping_type::is_always_unique()

◆ is_exhaustive()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_exhaustive ( ) const -> bool
inlineconstexprnoexcept

Determine if this mapping is exhaustive.

Returns
nested_mapping().is_exhaustive()

◆ is_strided()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_strided ( ) const -> bool
inlineconstexprnoexcept

Determine if this mapping is strided.

Returns
nested_mapping().is_strided()

◆ is_unique()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::is_unique ( ) const -> bool
inlineconstexprnoexcept

Determine if this mapping is unique.

Returns
nested_mapping().is_unique()

◆ nested_mapping()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::nested_mapping ( ) const -> nested_mapping_type const&
inlineconstexprnoexcept

Obtain the wrapped (un-transposed) mapping.

Returns
The nested mapping before the transpose is applied

◆ operator()()

template<class NestedLayout>
template<class Extents>
template<class Index0, class Index1>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::operator() ( Index0 index0,
Index1 index1 ) const -> index_type
inlineconstexprnoexcept

Access the flat element index for the given two-dimensional index.

Template Parameters
Index0The type of the first index
Index1The type of the second index
Parameters
index0The index into the first (transposed) dimension
index1The index into the second (transposed) dimension
Returns
nested_mapping()(index1, index0), i.e. the underlying element with the indices reversed

◆ required_span_size()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::required_span_size ( ) const -> index_type
inlineconstexprnoexcept

Obtain the required span size.

Returns
nested_mapping().required_span_size()

◆ stride()

template<class NestedLayout>
template<class Extents>
auto arene::base::linalg::layout_transpose< NestedLayout >::mapping< Extents >::stride ( rank_type rank_index) const -> index_type
inlineconstexprnoexcept

Obtain the stride along the specified (transposed) dimension.

Parameters
rank_indexThe (transposed) dimension index; 0 maps to the nested dimension 1 and vice versa
Returns
The stride of the nested mapping along the swapped dimension
Precondition
is_strided() is true, else ARENE_PRECONDITION violation
rank_index < 2, else ARENE_PRECONDITION violation

Friends And Related Symbol Documentation

◆ operator!=

template<class NestedLayout>
template<class Extents>
template<class OtherExtents, std::enable_if_t< is_equality_comparable_v< nested_mapping_type, typename mapping< OtherExtents >::nested_mapping_type > &&extents_type::rank()==OtherExtents::rank(), bool > = true>
auto operator!= ( mapping< Extents > const left,
mapping< OtherExtents > const right ) -> bool
friend

Compare two transposed mappings for inequality.

Template Parameters
OtherExtentsThe extents type of the right-hand side mapping
Parameters
leftA transposed mapping
rightA transposed mapping with possibly different extents
Returns
true if the wrapped nested mappings compare unequal

◆ operator==

template<class NestedLayout>
template<class Extents>
template<class OtherExtents, std::enable_if_t< is_equality_comparable_v< nested_mapping_type, typename mapping< OtherExtents >::nested_mapping_type > &&extents_type::rank()==OtherExtents::rank(), bool > = true>
auto operator== ( mapping< Extents > const left,
mapping< OtherExtents > const right ) -> bool
friend

Compare two transposed mappings for equality.

Template Parameters
OtherExtentsThe extents type of the right-hand side mapping
Parameters
leftA transposed mapping
rightA transposed mapping with possibly different extents
Returns
true if the wrapped nested mappings compare equal

◆ submdspan_mapping

template<class NestedLayout>
template<class Extents>
template<class CanonicalSlice0, class CanonicalSlice1, class Mapping = mapping>
auto submdspan_mapping ( mapping< Extents > const src,
CanonicalSlice0 slice0,
CanonicalSlice1 slice1 ) ->
friend

Compute the sub-mapping and offset for a transposed mapping.

Template Parameters
CanonicalSlice0The type of the slice specifier for the first (transposed) dimension
CanonicalSlice1The type of the slice specifier for the second (transposed) dimension
MappingDefaulted to mapping so the trailing return type can be SFINAE-friendly
Parameters
srcThe source transposed mapping to slice
slice0The slice specifier for the first (transposed) dimension
slice1The slice specifier for the second (transposed) dimension
Returns
A submdspan_mapping_result obtained by slicing the nested mapping with the slices reversed, then re-transposing a rank-2 result

Because layout_transpose swaps the two dimensions, slicing dimension 0 of the transpose is equivalent to slicing dimension 1 of the nested mapping. The slices are therefore reversed and forwarded to the nested mapping's own submdspan_mapping via do_submdspan_mapping. The resulting sub-mapping is re-transposed if it is still rank 2.


The documentation for this class was generated from the following file: