Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::extents< IndexType, Exts > Class Template Reference

Shape (per-axis sizes) of an mdspan, mixing compile-time and run-time extents. More...

#include <ah-mdspan.H>

Collaboration diagram for Aleph::extents< IndexType, Exts >:
[legend]

Public Types

using index_type = IndexType
 
using size_type = std::make_unsigned_t< IndexType >
 
using rank_type = size_t
 

Public Member Functions

constexpr extents () noexcept
 All-static-or-default-initialised extents (dynamic axes start at 0).
 
template<class... IndexTypes>
requires (sizeof...(IndexTypes) == mdspan_detail::count_dynamic<Exts...> and (std::is_convertible_v<IndexTypes, IndexType> and ...))
constexpr extents (IndexTypes... dyn) noexcept
 Construct providing a value for each dynamic axis, in rank order.
 
template<class OtherIndexType >
requires std::is_convertible_v<const OtherIndexType &, IndexType>
constexpr extents (const std::array< OtherIndexType, mdspan_detail::count_dynamic< Exts... > > &dyn) noexcept
 Construct providing every dynamic axis's value packed in an array.
 
constexpr index_type extent (rank_type r) const noexcept
 Run-time size of axis r.
 

Static Public Member Functions

static constexpr rank_type rank () noexcept
 Number of axes (compile-time constant).
 
static constexpr rank_type rank_dynamic () noexcept
 Number of axes whose extent is dynamic_extent (compile-time constant).
 
static constexpr size_t static_extent (rank_type r) noexcept
 Compile-time size of axis r, or dynamic_extent if axis r is dynamic.
 

Private Attributes

std::array< IndexType, sizeof...(Exts)> values_ {}
 

Static Private Attributes

static constexpr std::array< size_t, sizeof...(Exts)> Static {Exts...}
 

Friends

constexpr bool operator== (const extents &a, const extents &b) noexcept
 

Detailed Description

template<class IndexType, size_t... Exts>
class Aleph::extents< IndexType, Exts >

Shape (per-axis sizes) of an mdspan, mixing compile-time and run-time extents.

Template Parameters
IndexTypesigned or unsigned integral type used for indices.
Extsone size per axis: either a fixed value known at compile time, or Aleph::dynamic_extent for an axis whose size is only known at construction time. rank() is sizeof...(Exts).
Note
Simplification vs. std::extents: every axis (static or dynamic) is stored at run time in this polyfill, so the object does not shrink when axes are marked static. This has no effect on any currently-supported Aleph use case, which always uses dextents (fully dynamic).

Definition at line 302 of file ah-mdspan.H.

Member Typedef Documentation

◆ index_type

template<class IndexType , size_t... Exts>
using Aleph::extents< IndexType, Exts >::index_type = IndexType

Definition at line 312 of file ah-mdspan.H.

◆ rank_type

template<class IndexType , size_t... Exts>
using Aleph::extents< IndexType, Exts >::rank_type = size_t

Definition at line 314 of file ah-mdspan.H.

◆ size_type

template<class IndexType , size_t... Exts>
using Aleph::extents< IndexType, Exts >::size_type = std::make_unsigned_t<IndexType>

Definition at line 313 of file ah-mdspan.H.

Constructor & Destructor Documentation

◆ extents() [1/3]

template<class IndexType , size_t... Exts>
constexpr Aleph::extents< IndexType, Exts >::extents ( )
inlineconstexprnoexcept

All-static-or-default-initialised extents (dynamic axes start at 0).

Definition at line 329 of file ah-mdspan.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::dynamic_extent, r, Aleph::extents< IndexType, Exts >::rank(), Aleph::extents< IndexType, Exts >::Static, and Aleph::extents< IndexType, Exts >::values_.

Referenced by TEST().

◆ extents() [2/3]

template<class IndexType , size_t... Exts>
template<class... IndexTypes>
requires (sizeof...(IndexTypes) == mdspan_detail::count_dynamic<Exts...> and (std::is_convertible_v<IndexTypes, IndexType> and ...))
constexpr Aleph::extents< IndexType, Exts >::extents ( IndexTypes...  dyn)
inlineexplicitconstexprnoexcept

Construct providing a value for each dynamic axis, in rank order.

Parameters
dynone value per axis for which static_extent(r) == dynamic_extent, in increasing rank order. Static axes need no argument; their compile-time value is used unconditionally.

Definition at line 344 of file ah-mdspan.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::dynamic_extent, k, r, Aleph::extents< IndexType, Exts >::rank(), Aleph::extents< IndexType, Exts >::Static, and Aleph::extents< IndexType, Exts >::values_.

◆ extents() [3/3]

template<class IndexType , size_t... Exts>
template<class OtherIndexType >
requires std::is_convertible_v<const OtherIndexType &, IndexType>
constexpr Aleph::extents< IndexType, Exts >::extents ( const std::array< OtherIndexType, mdspan_detail::count_dynamic< Exts... > > &  dyn)
inlineexplicitconstexprnoexcept

Construct providing every dynamic axis's value packed in an array.

Parameters
dynone value per dynamic axis, in rank order; dyn.size() must equal rank_dynamic().

Definition at line 359 of file ah-mdspan.H.

References Aleph::blossom_maximum_cardinality_matching(), Aleph::dynamic_extent, k, r, Aleph::extents< IndexType, Exts >::rank(), Aleph::extents< IndexType, Exts >::Static, and Aleph::extents< IndexType, Exts >::values_.

Member Function Documentation

◆ extent()

template<class IndexType , size_t... Exts>
constexpr index_type Aleph::extents< IndexType, Exts >::extent ( rank_type  r) const
inlineconstexprnoexcept

Run-time size of axis r.

Parameters
rThe axis to query.
Returns
The extent of the specified axis.

Definition at line 372 of file ah-mdspan.H.

References r, and Aleph::extents< IndexType, Exts >::values_.

◆ rank()

template<class IndexType , size_t... Exts>
static constexpr rank_type Aleph::extents< IndexType, Exts >::rank ( )
inlinestaticconstexprnoexcept

◆ rank_dynamic()

template<class IndexType , size_t... Exts>
static constexpr rank_type Aleph::extents< IndexType, Exts >::rank_dynamic ( )
inlinestaticconstexprnoexcept

Number of axes whose extent is dynamic_extent (compile-time constant).

Definition at line 320 of file ah-mdspan.H.

References Aleph::blossom_maximum_cardinality_matching().

◆ static_extent()

template<class IndexType , size_t... Exts>
static constexpr size_t Aleph::extents< IndexType, Exts >::static_extent ( rank_type  r)
inlinestaticconstexprnoexcept

Compile-time size of axis r, or dynamic_extent if axis r is dynamic.

Definition at line 326 of file ah-mdspan.H.

References r, and Aleph::extents< IndexType, Exts >::Static.

Friends And Related Symbol Documentation

◆ operator==

template<class IndexType , size_t... Exts>
constexpr bool operator== ( const extents< IndexType, Exts > &  a,
const extents< IndexType, Exts > &  b 
)
friend

Definition at line 374 of file ah-mdspan.H.

Member Data Documentation

◆ Static

template<class IndexType , size_t... Exts>
constexpr std::array<size_t, sizeof...(Exts)> Aleph::extents< IndexType, Exts >::Static {Exts...}
staticconstexprprivate

◆ values_


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