A non-owning, strided view over a contiguous buffer. Should be passed by value.
More...
|
| | MultiArrayView (const MultiArrayView &)=default |
| |
| | MultiArrayView (MultiArrayView &&)=default |
| |
| | MultiArrayView ()=default |
| |
| MultiArrayView & | operator= (const MultiArrayView &)=default |
| |
| MultiArrayView & | operator= (MultiArrayView &&)=default |
| |
| | MultiArrayView (Extents< RANK > extents, Extents< RANK > strides, size_t offset, auto &&... dataView) |
| | Constructs a view with explicit extents, strides, offset, and data span. The offset accumulates from prior slicing operations.
|
| |
| | operator MultiArrayView< const T, RANK > () const |
| | Implicit conversion to a const view (MultiArrayView<const T, RANK>).
|
| |
| void | checkBounds (std::convertible_to< size_t > auto ... i) const |
| | Bounds-check all indices against extents. Active only in debug builds (NDEBUG not defined).
|
| |
| T & | operator() (Extents< RANK > idx) const |
| | Subscript by Extents<RANK> multi-index. Always const — does not modify the view, only potentially the underlying data.
|
| |
| T & | operator() (std::convertible_to< size_t > auto ... i) const |
| | Subscript by individual indices, one per rank. Requires sizeof...(i) == RANK.
|
| |
| T & | operator() (std::convertible_to< size_t > auto i) const |
| | Rank-1 specialization: single-index subscript.
|
| |
| T & | operator() (std::convertible_to< size_t > auto i, std::convertible_to< size_t > auto j) const |
| | Rank-2 specialization: two-index subscript.
|
| |
| auto | operator() (std::convertible_to< size_t > auto i, multiarray::Placeholder) const |
| | Rank-2 row slice: mav(i, _) returns a rank-1 view of row i.
|
| |
| auto | operator() (multiarray::Placeholder, std::convertible_to< size_t > auto j) const |
| | Rank-2 column slice: mav(_, j) returns a rank-1 view of column j.
|
| |
template<
typename T,
size_t RANK>
class cppqedutils::MultiArrayView< T, RANK >
A non-owning, strided view over a contiguous buffer. Should be passed by value.
Follows pointer-like (reference) semantics regarding constness: a const MultiArrayView<T,R> still allows mutation of the underlying data, just as a T* const does. All four combinations of (const) MultiArrayView<(const) T, RANK> are usable.
The flat storage index for multi-index \((i_0,\ldots,i_{R-1})\) is
\[ \text{offset} + \sum_{\iota=0}^{R-1} s_\iota\, i_\iota \]
where \(s\) are the strides and \(\text{offset}\) accumulates from prior slicing.
- Todo:
- Alternative design:
MultiArrayBase<StorageType> parameterized on storage, unifying view and owning cases without inheritance.