template<int Rank, uint64_t StaticExtents, uint64_t StrideOrder,
layout_prop_e LayoutProp>
class nda::rect_str< Rank, StaticExtents, StrideOrder, LayoutProp >
Layout that specifies how to map multi-dimensional indices including possible string indices to a linear/flat index.
It extends the functionality of nda::idx_map by supporting string indices.
- Template Parameters
-
Rank | Number of dimensions. |
StaticExtent | Compile-time known shape (zero if fully dynamic). |
StrideOrder | Order in which the dimensions are stored in memory. |
LayoutProp | Compile-time guarantees about the layout of the data in memory. |
Definition at line 79 of file rect_str.hpp.
|
| rect_str ()=default |
| Default constructor.
|
|
| rect_str (base_t const &idxm) noexcept |
| Construct an nda::rect_str from a given nda::idx_map.
|
|
| rect_str (base_t const &idxm, ind_t const &str_indices) noexcept |
| Construct an nda::rect_str from a given nda::idx_map and string indices.
|
|
| rect_str (nda::array< nda::array< std::string, 1 >, 1 > str_indices) noexcept(false) |
| Construct an nda::rect_str from given string indices and with contiguous strides.
|
|
| rect_str (rect_str &&)=default |
| Default move constructor.
|
|
| rect_str (rect_str const &)=default |
| Default copy constructor.
|
|
template<uint64_t SE, layout_prop_e LP> |
| rect_str (rect_str< Rank, SE, StrideOrder, LP > const &rstr) noexcept(false) |
| Construct an nda::rect_str from another nda::rect_str with different layout properties and static extents.
|
|
template<layout_prop_e LP> |
| rect_str (rect_str< Rank, StaticExtents, StrideOrder, LP > const &rstr) noexcept |
| Construct an nda::rect_str from another nda::rect_str with different layout properties.
|
|
| rect_str (std::array< long, base_t::n_dynamic_extents > const &shape) noexcept |
| Construct an nda::rect_str from an array with its dynamic extents.
|
|
| rect_str (std::array< long, Rank > const &shape) noexcept |
| Construct an nda::rect_str from a given shape and with contiguous strides.
|
|
| rect_str (std::array< long, Rank > const &shape, std::array< long, Rank > const &strides) noexcept |
| Construct an nda::rect_str from a given shape and strides.
|
|
auto const & | get_string_indices () const |
| Get the string indices.
|
|
bool | operator!= (rect_str const &rhs) |
| Not-equal-to operator for two nda::rect_str objects.
|
|
template<typename... Args> |
__inline__ long | operator() (Args const &...args) const |
| Function call operator to map a given multi-dimensional index to a linear index.
|
|
rect_str & | operator= (rect_str &&)=default |
| Default move assignment operator.
|
|
rect_str & | operator= (rect_str const &)=default |
| Default copy assignment operator.
|
|
bool | operator== (rect_str const &rhs) const |
| Equal-to operator for two nda::rect_str objects.
|
|
template<typename... Args> |
auto | slice (Args const &...args) const |
| Get a new nda::rect_str by taking a slice of the current one.
|
|
template<uint64_t Permutation> |
auto | transpose () const |
| Create a new nda::rect_str by permuting the indices/dimensions with a given permutation.
|
|
| idx_map () |
| Default constructor.
|
|
| idx_map (idx_map &&)=default |
| Default move constructor.
|
|
| idx_map (idx_map const &)=default |
| Default copy constructor.
|
|
template<uint64_t SE, uint64_t SO, layout_prop_e LP>
requires (stride_order_encoded != SO) |
| idx_map (idx_map< Rank, SE, SO, LP > const &) |
| Construct a new map from an existing map with a different stride order.
|
|
template<uint64_t SE, layout_prop_e LP> |
| idx_map (idx_map< Rank, SE, StrideOrder, LP > const &idxm) noexcept(false) |
| Construct a new map from an existing map with different layout properties and different static extents.
|
|
template<layout_prop_e LP> |
| idx_map (idx_map< Rank, StaticExtents, StrideOrder, LP > const &idxm) noexcept |
| Construct a new map from an existing map with different layout properties.
|
|
template<std::integral Int = long> |
| idx_map (std::array< Int, Rank > const &shape) noexcept |
| Construct a new map from a given shape and with contiguous strides.
|
|
| idx_map (std::array< long, n_dynamic_extents > const &shape) noexcept |
| Construct a new map from an array with its dynamic extents.
|
|
template<int R>
requires (R != Rank) |
| idx_map (std::array< long, R > const &) |
| Construct a new map with a shape of a different rank.
|
|
| idx_map (std::array< long, Rank > const &shape, std::array< long, Rank > const &strides) noexcept(!check_stride_order) |
| Construct a new map from a given shape and strides.
|
|
bool | is_contiguous () const noexcept |
| Is the data contiguous in memory?
|
|
bool | is_stride_order_valid () const |
| Check if the shape and strides of the current map are compatible with its stride order.
|
|
bool | is_strided_1d () const noexcept |
| Is the data strided in memory with a constant stride?
|
|
std::array< long, Rank > const & | lengths () const noexcept |
| Get the extents of all dimensions.
|
|
long | min_stride () const noexcept |
| Get the value of the smallest stride.
|
|
template<typename... Args> |
__inline__ long | operator() (Args const &...args) const noexcept(true) |
| Function call operator to map a given multi-dimensional index to a linear index.
|
|
idx_map & | operator= (idx_map &&)=default |
| Default move assignment operator.
|
|
idx_map & | operator= (idx_map const &)=default |
| Default copy assignment operator.
|
|
template<int R, uint64_t SE, uint64_t SO, layout_prop_e LP> |
bool | operator== (idx_map< R, SE, SO, LP > const &rhs) const |
| Equal-to operator for two nda::idx_map objects.
|
|
long | size () const noexcept |
| Get the total number of elements.
|
|
template<typename... Args> |
auto | slice (Args const &...args) const |
| Get a new nda::idx_map by taking a slice of the current one.
|
|
std::array< long, Rank > const & | strides () const noexcept |
| Get the strides of all dimensions.
|
|
std::array< long, Rank > | to_idx (long lin_idx) const |
| Calculate the multi-dimensional index from a given linear index.
|
|
template<uint64_t Permutation> |
auto | transpose () const |
| Create a new map by permuting the indices/dimensions of the current map with a given permutation.
|
|
|
template<typename T > |
static constexpr int | argument_is_allowed_for_call = base_t::template argument_is_allowed_for_call<T> or std::is_constructible_v<std::string, T> |
| Alias template to check if type T can be used to access a specific element.
|
|
template<typename T > |
static constexpr int | argument_is_allowed_for_call_or_slice |
| Alias template to check if type T can be used to either access a specific element or a slice of elements.
|
|
template<typename T > |
static constexpr int | argument_is_allowed_for_call = std::is_constructible_v<long, T> |
| Alias template to check if type T can be used to access a single element.
|
|
template<typename T > |
static constexpr int | argument_is_allowed_for_call_or_slice |
| Alias template to check if type T can be used to either access a single element or a slice of elements.
|
|
static constexpr layout_info_t | layout_info = layout_info_t{stride_order_encoded, layout_prop} |
| Compile-time information about the layout (stride order and layout properties).
|
|
static constexpr layout_prop_e | layout_prop = LayoutProp |
| Compile-time memory layout properties.
|
|
static constexpr std::array< int, Rank > | static_extents = decode<Rank>(StaticExtents) |
| Decoded static extents.
|
|
static constexpr uint64_t | static_extents_encoded = StaticExtents |
| Encoded static extents.
|
|
static constexpr std::array< int, Rank > | stride_order = (StrideOrder == 0 ? permutations::identity<Rank>() : decode<Rank>(StrideOrder)) |
| Decoded stride order.
|
|
static constexpr uint64_t | stride_order_encoded = encode(stride_order) |
| Encoded stride order.
|
|