|
Stratax
Scientific computing containers and operations
|
Stores strides for a shape in contiguous memory. More...
#include <Strides.hpp>
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 | |
| Strides (Strides &&) noexcept=default | |
| Strides & | operator= (const Strides &)=default |
| Strides & | operator= (Strides &&) noexcept=default |
| ~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. | |
| const std::size_t * | begin () noexcept |
| Returns an iterator to the first stride value. | |
| const std::size_t * | begin () const noexcept |
| Returns a const iterator to the first stride value. | |
| const std::size_t * | cbegin () const noexcept |
| Returns a const iterator to the first stride value. | |
| const std::size_t * | end () noexcept |
| Returns an iterator one past the last stride value. | |
| const std::size_t * | end () const noexcept |
| Returns a const iterator one past the last stride value. | |
| const std::size_t * | cend () const noexcept |
| Returns a const iterator one past the last stride value. | |
| std::reverse_iterator< const std::size_t * > | rbegin () noexcept |
| Returns a reverse iterator to the last stride value. | |
| std::reverse_iterator< const std::size_t * > | rbegin () const noexcept |
| Returns a const reverse iterator to the last stride value. | |
| std::reverse_iterator< const std::size_t * > | crbegin () const noexcept |
| Returns a const reverse iterator to the last stride value. | |
| std::reverse_iterator< const std::size_t * > | rend () noexcept |
| Returns a reverse iterator before the first stride value. | |
| std::reverse_iterator< const std::size_t * > | rend () const noexcept |
| Returns a const reverse iterator before the first stride value. | |
| std::reverse_iterator< const std::size_t * > | 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.
|
defaultnoexcept |
Creates an empty stride vector.
Referenced by operator!=(), operator=(), operator=(), operator==(), Strides(), Strides(), Strides(), swap(), and ~Strides().
|
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 43 of file Strides.hpp.
|
default |
References Strides().
|
defaultnoexcept |
References Strides().
|
default |
Destroys the stride vector.
References Strides().
|
inline |
Returns a stride value with bounds checking.
| index | Stride index. |
| Exceptions::IndexError | If the index is out of bounds. |
Definition at line 123 of file Strides.hpp.
References rank(), and stratax::core::validation::require_index().
|
inline |
Returns the last stride value.
Definition at line 144 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first stride value.
Definition at line 174 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator to the first stride value.
Definition at line 164 of file Strides.hpp.
Referenced by offset().
|
inlinenodiscardnoexcept |
Returns a const iterator to the first stride value.
Definition at line 184 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last stride value.
Definition at line 214 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last stride value.
Definition at line 244 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first stride value.
Definition at line 274 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the raw stride data pointer.
Definition at line 154 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns whether the stride vector is empty.
Definition at line 86 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last stride value.
Definition at line 204 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator one past the last stride value.
Definition at line 194 of file Strides.hpp.
|
inline |
Returns the first stride value.
Definition at line 134 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns whether two stride vectors differ.
| other | Strides object to compare against. |
Definition at line 318 of file Strides.hpp.
References Strides().
|
inline |
Returns a stride value without bounds checking.
| index | Stride index. |
Definition at line 109 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Compares two stride vectors for equality.
| other | Strides object to compare against. |
Definition at line 296 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the number of dimensions represented by the strides.
Definition at line 96 of file Strides.hpp.
Referenced by at(), offset(), stratax::core::operator<<(), operator==(), and Strides().
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last stride value.
Definition at line 234 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator to the last stride value.
Definition at line 224 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first stride value.
Definition at line 264 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator before the first stride value.
Definition at line 254 of file Strides.hpp.
|
inlinenodiscardnoexcept |
Returns the number of stored stride values.
Definition at line 76 of file Strides.hpp.
References size().
Referenced by size().
|
inlinenoexcept |
Swaps the stored strides with another instance.
| other | Strides object to exchange state with. |
Definition at line 284 of file Strides.hpp.
References Strides().