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

An mdspan layout mapping for the specified ExtentsType. More...

Inheritance diagram for arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >:
Inheritance graph

Public Types

using extents_type = ExtentsType
 The type of the extents.
 
using index_type = typename extents_type::index_type
 The index type for the extents.
 
using layout_type = layout_constant_diagonal
 The layout mapping policy type for this mapping.
 
using offsets_type = OffsetExtentsType
 The type of the offsets.
 
using rank_type = typename extents_type::rank_type
 The rank type for the extents.
 

Public Member Functions

constexpr mapping ()=default
 Construct the mapping with default-constructed extents and offsets.
 
constexpr mapping (extents_type const &source_extents) noexcept
 Construct the mapping with the specified extents.
 
constexpr mapping (extents_type const &source_extents, offsets_type const &offset_extents) noexcept
 Construct the mapping with the specified extents and offsets.
 
 mapping (mapping &&)=default
 Default move constructor.
 
 mapping (mapping const &)=default
 Default copy constructor.
 
 ~mapping ()=default
 Default destructor.
 
constexpr auto extents () const noexcept -> ExtentsType const &
 Obtain the extents of the layout.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< SfinaeExtentsType::rank()==0 > > = nullptr>
constexpr auto is_exhaustive () const noexcept -> bool
 Check if this layout is exhaustive.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto is_exhaustive () const noexcept -> bool
 Check if this layout is exhaustive.
 
template<typename SfinaeExtentsType = ExtentsType, typename SfinaeOffsets = OffsetExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic()==0 >, std::enable_if_t< SfinaeOffsets::rank_dynamic()==0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto is_exhaustive () const noexcept -> bool
 Check if this layout is exhaustive.
 
template<typename SfinaeExtentsType = ExtentsType, typename SfinaeOffsets = OffsetExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t<(SfinaeExtentsType::rank_dynamic() !=0)||(SfinaeOffsets::rank_dynamic() !=0)>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto is_exhaustive () const noexcept -> bool
 Check if this layout is exhaustive.
 
constexpr auto is_unique () const noexcept -> bool
 Check if there is exactly one index combination for each target element.
 
constexpr auto offsets () const noexcept -> OffsetExtentsType const &
 Obtain the offsets of the layout.
 
template<typename... Indices, constraints< std::enable_if_t< sizeof...(Indices)==ExtentsType::rank()> > = nullptr>
constexpr auto operator() (Indices... indices) const noexcept -> index_type
 Get the index from the underlying storage to use for the specified combination of indices.
 
auto operator= (mapping &&) -> mapping &=default
 Default move constructor.
 
auto operator= (mapping const &) -> mapping &=default
 Default copy assignment operator.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< SfinaeExtentsType::rank()==0 > > = nullptr>
constexpr auto required_span_size () const noexcept -> index_type
 The required span size for the underlying storage.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto required_span_size () const noexcept -> index_type
 The required span size for the underlying storage.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic()==0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto required_span_size () const noexcept -> index_type
 The required span size for the underlying storage.
 
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic() !=0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
constexpr auto required_span_size () const noexcept -> index_type
 The required span size for the underlying storage.
 
constexpr auto stride (rank_type) const noexcept -> index_type
 Get the stride for the provided dimension. Provided for interface compatibility only.
 

Static Public Member Functions

static constexpr auto is_always_exhaustive () noexcept -> bool
 Check if this is always an exhaustive layout.
 
static constexpr auto is_always_strided () noexcept -> bool
 Check if this is always a strided layout, which it is not.
 
static constexpr auto is_always_unique () noexcept -> bool
 Check if this is always a unique layout.
 
static constexpr auto is_strided () noexcept -> bool
 Check if this is a strided layout, which it is not.
 

Friends

constexpr auto operator!= (mapping const &lhs, mapping const &rhs) noexcept -> bool
 Inequality comparison: two mappings are not equal if they have the different offsets or extents.
 
constexpr auto operator== (mapping const &lhs, mapping const &rhs) noexcept -> bool
 Equality comparison: two mappings are equal if they have the same offsets and extents.
 

Detailed Description

template<typename OffsetExtentsType>
template<typename ExtentsType>
class arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >

An mdspan layout mapping for the specified ExtentsType.

Member Typedef Documentation

◆ extents_type

template<typename OffsetExtentsType>
template<typename ExtentsType>
using arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::extents_type = ExtentsType

The type of the extents.

◆ index_type

template<typename OffsetExtentsType>
template<typename ExtentsType>
using arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::index_type = typename extents_type::index_type

The index type for the extents.

◆ layout_type

template<typename OffsetExtentsType>
template<typename ExtentsType>
using arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::layout_type = layout_constant_diagonal

The layout mapping policy type for this mapping.

◆ offsets_type

template<typename OffsetExtentsType>
template<typename ExtentsType>
using arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::offsets_type = OffsetExtentsType

The type of the offsets.

◆ rank_type

template<typename OffsetExtentsType>
template<typename ExtentsType>
using arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::rank_type = typename extents_type::rank_type

The rank type for the extents.

Constructor & Destructor Documentation

◆ mapping() [1/5]

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::mapping ( )
constexprdefault

Construct the mapping with default-constructed extents and offsets.

◆ mapping() [2/5]

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::mapping ( extents_type const & source_extents)
inlineexplicitconstexprnoexcept

Construct the mapping with the specified extents.

Parameters
source_extentsthe extents to use for this mapping

◆ mapping() [3/5]

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::mapping ( extents_type const & source_extents,
offsets_type const & offset_extents )
inlineconstexprnoexcept

Construct the mapping with the specified extents and offsets.

Parameters
source_extentsthe extents to use for this mapping
offset_extentsan extents object specifying the offsets to use for this mapping

◆ ~mapping()

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::~mapping ( )
default

Default destructor.

◆ mapping() [4/5]

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::mapping ( mapping< ExtentsType > const & )
default

Default copy constructor.

◆ mapping() [5/5]

template<typename OffsetExtentsType>
template<typename ExtentsType>
arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::mapping ( mapping< ExtentsType > && )
default

Default move constructor.

Member Function Documentation

◆ extents()

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::extents ( ) const -> ExtentsType const&
inlineconstexprnoexcept

Obtain the extents of the layout.

Returns
The stored ExtentsType object

◆ is_always_exhaustive()

template<typename OffsetExtentsType>
template<typename ExtentsType>
static constexpr auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_always_exhaustive ( ) -> bool
inlinestaticconstexprnoexcept

Check if this is always an exhaustive layout.

This requires that all extents and offsets are static constants, and that the specific values give an exhaustive layout

Returns
true if always unique, false otherwise

◆ is_always_strided()

template<typename OffsetExtentsType>
template<typename ExtentsType>
static constexpr auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_always_strided ( ) -> bool
inlinestaticconstexprnoexcept

Check if this is always a strided layout, which it is not.

Returns
false

◆ is_always_unique()

template<typename OffsetExtentsType>
template<typename ExtentsType>
static constexpr auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_always_unique ( ) -> bool
inlinestaticconstexprnoexcept

Check if this is always a unique layout.

Identifying all the cases where this is true requires too much implementation complexity, so this function may return false even if the layout is always a unique layout.

Returns
true if always unique, false if it may not be always unique

◆ is_exhaustive() [1/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< SfinaeExtentsType::rank()==0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_exhaustive ( ) const -> bool
inlineconstexprnoexcept

Check if this layout is exhaustive.

For rank zero layouts, this is always true

Returns
true if exhaustive, false otherwise

◆ is_exhaustive() [2/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_exhaustive ( ) const -> bool
inlineconstexprnoexcept

Check if this layout is exhaustive.

This is always true for extents that have a dimension with a static extent of zero

Returns
true if exhaustive, false otherwise

◆ is_exhaustive() [3/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, typename SfinaeOffsets = OffsetExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic()==0 >, std::enable_if_t< SfinaeOffsets::rank_dynamic()==0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_exhaustive ( ) const -> bool
inlineconstexprnoexcept

Check if this layout is exhaustive.

For non-rank-zero layouts, this depends on the extents and offsets: if there is at least one dimension with an extent of two or more, no dimensions with an extent of zero, and there is at least one value of index for each dimension such that index+offset is the same for all dimensions

Returns
true if exhaustive, false otherwise

◆ is_exhaustive() [4/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, typename SfinaeOffsets = OffsetExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t<(SfinaeExtentsType::rank_dynamic() !=0)||(SfinaeOffsets::rank_dynamic() !=0)>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_exhaustive ( ) const -> bool
inlineconstexprnoexcept

Check if this layout is exhaustive.

For non-rank-zero layouts, this depends on the extents and offsets: if there is at least one dimension with an extent of two or more, no dimensions with an extent of zero, and there is at least one value of index for each dimension such that index+offset is the same for all dimensions

Returns
true if exhaustive, false otherwise

◆ is_strided()

template<typename OffsetExtentsType>
template<typename ExtentsType>
static constexpr auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_strided ( ) -> bool
inlinestaticconstexprnoexcept

Check if this is a strided layout, which it is not.

Returns
false

◆ is_unique()

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::is_unique ( ) const -> bool
inlineconstexprnoexcept

Check if there is exactly one index combination for each target element.

This must be the case of it returns true, may or not be the case if it returns false ; identifying all the cases where it is true requires too much implementation complexity.

Returns
true if conclusively so, false if not guaranteed

◆ offsets()

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::offsets ( ) const -> OffsetExtentsType const&
inlineconstexprnoexcept

Obtain the offsets of the layout.

Returns
The stored OffsetExtentsType object

◆ operator()()

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename... Indices, constraints< std::enable_if_t< sizeof...(Indices)==ExtentsType::rank()> > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::operator() ( Indices... indices) const -> index_type
inlineconstexprnoexcept

Get the index from the underlying storage to use for the specified combination of indices.

Template Parameters
IndicesThe types of the indices
Parameters
indicesThe indices to retrieve the mapped index for
Precondition
The number of elements in Indices must equal ExtentsType::rank()
Returns
The mapped index, which is 0 for values on the diagonal, 1 otherwise.

◆ operator=() [1/2]

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::operator= ( mapping< ExtentsType > && ) -> mapping &=default
default

Default move constructor.

◆ operator=() [2/2]

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::operator= ( mapping< ExtentsType > const & ) -> mapping &=default
default

Default copy assignment operator.

◆ required_span_size() [1/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< SfinaeExtentsType::rank()==0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::required_span_size ( ) const -> index_type
inlineconstexprnoexcept

The required span size for the underlying storage.

This is 1 for a zero-rank mdspan since there is exactly one element

Returns
1

◆ required_span_size() [2/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t< layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::required_span_size ( ) const -> index_type
inlineconstexprnoexcept

The required span size for the underlying storage.

This is 0 where any of the extents are statically zero

Returns
0

◆ required_span_size() [3/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic()==0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::required_span_size ( ) const -> index_type
inlineconstexprnoexcept

The required span size for the underlying storage.

This is 2 where all extents are statically non-zero

Returns
2

◆ required_span_size() [4/4]

template<typename OffsetExtentsType>
template<typename ExtentsType>
template<typename SfinaeExtentsType = ExtentsType, arene::base::constraints< std::enable_if_t< std::is_same< SfinaeExtentsType, ExtentsType >::value >, std::enable_if_t<!layout_constant_diagonal_detail::any_static_extents_are_zero< SfinaeExtentsType >()>, std::enable_if_t< SfinaeExtentsType::rank_dynamic() !=0 >, std::enable_if_t< SfinaeExtentsType::rank() !=0 > > = nullptr>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::required_span_size ( ) const -> index_type
inlineconstexprnoexcept

The required span size for the underlying storage.

This is 0 or 2 for a non-zero-rank mdspan : zero where any of the extents are zero, 2 otherwise (on diagonal and off-diagonal)

Returns
0 if any extent is zero, 2 otherwise

◆ stride()

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto arene::base::linalg::layout_constant_diagonal< OffsetExtentsType >::mapping< ExtentsType >::stride ( rank_type ) const -> index_type
inlineconstexprnoexcept

Get the stride for the provided dimension. Provided for interface compatibility only.

Precondition
This function cannot be legitimately called
Returns
Never returns

Friends And Related Symbol Documentation

◆ operator!=

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto operator!= ( mapping< ExtentsType > const & lhs,
mapping< ExtentsType > const & rhs ) -> bool
friend

Inequality comparison: two mappings are not equal if they have the different offsets or extents.

Parameters
lhsThe first mapping
rhsThe second mapping
Returns
true if the mappings are not the same, false otherwise

◆ operator==

template<typename OffsetExtentsType>
template<typename ExtentsType>
auto operator== ( mapping< ExtentsType > const & lhs,
mapping< ExtentsType > const & rhs ) -> bool
friend

Equality comparison: two mappings are equal if they have the same offsets and extents.

Parameters
lhsThe first mapping
rhsThe second mapping
Returns
true if the mappings are the same, false otherwise

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