|
Stratax 0.2.0
|
Stores strides for a shape in contiguous memory. More...
#include <Strides.hpp>
Public Types | |
| using | iterator = Buffer<std::size_t>::const_iterator |
| Iterator over immutable stride values. | |
| using | const_iterator = Buffer<std::size_t>::const_iterator |
| Const iterator over stride values. | |
| using | reverse_iterator = Buffer<std::size_t>::const_reverse_iterator |
| Reverse iterator over immutable stride values. | |
| using | const_reverse_iterator = Buffer<std::size_t>::const_reverse_iterator |
| Const reverse iterator over stride values. | |
Public Member Functions | |
| Strides () noexcept=default | |
| Creates an empty stride vector. | |
| Strides (const Shape &shape) | |
| Creates row-major strides for a given shape. | |
| Strides (const Strides &)=default | |
| Copies stride metadata. | |
| Strides (Strides &&) noexcept=default | |
| Moves stride metadata. | |
| Strides & | operator= (const Strides &)=default |
| Copy-assigns stride metadata. | |
| Strides & | operator= (Strides &&) noexcept=default |
| Move-assigns stride metadata. | |
| ~Strides ()=default | |
| Destroys the stride vector. | |
| std::size_t | size () const noexcept |
| Returns the number of stored stride values. | |
| bool | empty () const noexcept |
| Returns whether the stride vector is empty. | |
| std::size_t | rank () const noexcept |
| Returns the number of dimensions represented by the strides. | |
| const std::size_t & | operator() (std::size_t index) const |
| Returns a stride value without bounds checking. | |
| const std::size_t & | at (std::size_t index) const |
| Returns a stride value with bounds checking. | |
| const std::size_t & | front () const |
| Returns the first stride value. | |
| const std::size_t & | back () const |
| Returns the last stride value. | |
| const std::size_t * | data () const noexcept |
| Returns the raw stride data pointer. | |
| iterator | begin () noexcept |
| Returns an iterator to the first stride value. | |
| const_iterator | begin () const noexcept |
| Returns a const iterator to the first stride value. | |
| const_iterator | cbegin () const noexcept |
| Returns a const iterator to the first stride value. | |
| iterator | end () noexcept |
| Returns an iterator one past the last stride value. | |
| const_iterator | end () const noexcept |
| Returns a const iterator one past the last stride value. | |
| const_iterator | cend () const noexcept |
| Returns a const iterator one past the last stride value. | |
| reverse_iterator | rbegin () noexcept |
| Returns a reverse iterator to the last stride value. | |
| const_reverse_iterator | rbegin () const noexcept |
| Returns a const reverse iterator to the last stride value. | |
| const_reverse_iterator | crbegin () const noexcept |
| Returns a const reverse iterator to the last stride value. | |
| reverse_iterator | rend () noexcept |
| Returns a reverse iterator before the first stride value. | |
| const_reverse_iterator | rend () const noexcept |
| Returns a const reverse iterator before the first stride value. | |
| const_reverse_iterator | crend () const noexcept |
| Returns a const reverse iterator before the first stride value. | |
| void | swap (Strides &other) noexcept |
| Swaps the stored strides with another instance. | |
| bool | operator== (const Strides &other) const noexcept |
| Compares two stride vectors for equality. | |
| bool | operator!= (const Strides &other) const noexcept |
| Returns whether two stride vectors differ. | |
Stores strides for a shape in contiguous memory.
Strides map logical indices to flat storage offsets, typically for row-major layout. The values are stored as metadata and do not own any array elements.
Definition at line 22 of file Strides.hpp.
| using stratax::core::Strides::const_iterator = Buffer<std::size_t>::const_iterator |
Const iterator over stride values.
Definition at line 32 of file Strides.hpp.
| using stratax::core::Strides::const_reverse_iterator = Buffer<std::size_t>::const_reverse_iterator |
Const reverse iterator over stride values.
Definition at line 38 of file Strides.hpp.
| using stratax::core::Strides::iterator = Buffer<std::size_t>::const_iterator |
Iterator over immutable stride values.
Definition at line 29 of file Strides.hpp.
| using stratax::core::Strides::reverse_iterator = Buffer<std::size_t>::const_reverse_iterator |
Reverse iterator over immutable stride values.
Definition at line 35 of file Strides.hpp.
|
inlineexplicit |
Creates row-major strides for a given shape.
The last dimension receives stride 1 and each preceding dimension is computed from the product of the dimensions to its right.
| shape | Source shape used to derive stride values. |
| Exceptions::DimensionError | If stride computation overflows. |
Definition at line 55 of file Strides.hpp.
|
inline |
Returns a stride value with bounds checking.
| index | Stride index. |
| Exceptions::IndexError | If the index is out of bounds. |
Definition at line 141 of file Strides.hpp.
|
inline |
Returns the last stride value.
Definition at line 162 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first stride value.
Definition at line 192 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator to the first stride value.
Definition at line 182 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first stride value.
Definition at line 202 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last stride value.
Definition at line 232 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last stride value.
Definition at line 262 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first stride value.
Definition at line 292 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the raw stride data pointer.
Definition at line 172 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns whether the stride vector is empty.
Definition at line 104 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last stride value.
Definition at line 222 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator one past the last stride value.
Definition at line 212 of file Strides.hpp.
|
inline |
Returns the first stride value.
Definition at line 152 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns whether two stride vectors differ.
| other | Strides object to compare against. |
Definition at line 336 of file Strides.hpp.
|
inline |
Returns a stride value without bounds checking.
| index | Stride index. |
Definition at line 127 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Compares two stride vectors for equality.
| other | Strides object to compare against. |
Definition at line 314 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the number of dimensions represented by the strides.
Definition at line 114 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last stride value.
Definition at line 252 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator to the last stride value.
Definition at line 242 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first stride value.
Definition at line 282 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator before the first stride value.
Definition at line 272 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the number of stored stride values.
Definition at line 94 of file Strides.hpp.
|
inlinenoexcept |
Swaps the stored strides with another instance.
| other | Strides object to exchange state with. |
Definition at line 302 of file Strides.hpp.