|
constexpr | Strides () noexcept=default |
| Default constructor (rank 0).
|
|
template<Integral... Sizes> |
constexpr | Strides (Sizes... sizes) |
| Constructs strides from variadic size arguments.
|
|
template<Iterator Iterator> |
constexpr | Strides (Iterator begin, Iterator end) |
| Constructs strides from a pair of iterators.
|
|
constexpr | Strides (const Shape &shape) |
| Constructs strides from a shape assuming row-major layout.
|
|
constexpr size_type * | address () noexcept |
| Returns a pointer to the underlying data (non-const).
|
|
constexpr size_type const * | address () const noexcept |
| Returns a pointer to the underlying data (const).
|
|
constexpr auto | rank () const noexcept |
| Returns the number of dimensions (rank).
|
|
constexpr auto | front () const |
| Returns the first stride value.
|
|
constexpr auto | back () const |
| Returns the last stride value.
|
|
template<Integral Index> |
constexpr auto const & | operator[] (Index index) const |
| Accesses a stride value by index (const).
|
|
template<Integral Index> |
constexpr auto & | operator[] (Index index) |
| Accesses a stride value by index (non-const).
|
|
constexpr void | expand (size_type size) |
| Expands the strides's last dimension with a given size.
|
|
|
|
constexpr auto | begin () |
|
constexpr auto | end () |
|
constexpr auto | begin () const |
|
constexpr auto | end () const |
|
constexpr auto | cbegin () const |
|
constexpr auto | cend () const |
|
Represents the memory strides associated with a tensor shape.
Strides
describes how many elements must be skipped in memory to move between elements along each tensor dimension. It is a key part of defining how multidimensional data is stored and accessed in memory.
A Strides
object can be constructed manually (via variadic arguments or iterators), or automatically from a Shape
(default row-major/contiguous layout).
Maximum rank is limited to Strides::limit = 8
for constexpr compatibility and static layout. This limit may be removed in C++26 when std::vector become constexpr friendly.
Example (Contiguous Layout):
std::cout << strides;
Represents the shape (dimensions) of an tensor-like expression.
Definition: shape.hpp:79
Represents the memory strides associated with a tensor shape.
Definition: strides.hpp:87
Definition: buffer.hpp:41
Example (Custom Strides):