|
Stratax 0.3.1
|
Shared owning storage and layout base for Stratax array containers. More...
#include <ArrayBase.hpp>

Public Types | |
| using | value_type = typename Buffer< T >::value_type |
| Stored element type. | |
| using | size_type = typename Buffer< value_type >::size_type |
| Unsigned type used for element counts and indices. | |
| using | difference_type = typename Buffer< value_type >::difference_type |
| Signed type used for checked indices and iterator distances. | |
| using | reference = typename Buffer< value_type >::reference |
| Mutable element reference type. | |
| using | const_reference = typename Buffer< value_type >::const_reference |
| Read-only element reference type. | |
| using | pointer = typename Buffer< value_type >::pointer |
| Mutable element pointer type. | |
| using | const_pointer = typename Buffer< value_type >::const_pointer |
| Read-only element pointer type. | |
| using | iterator = typename Buffer< value_type >::iterator |
| Mutable contiguous random-access iterator type. | |
| using | const_iterator = typename Buffer< value_type >::const_iterator |
| Read-only contiguous random-access iterator type. | |
| using | reverse_iterator = typename Buffer< value_type >::reverse_iterator |
| Mutable reverse iterator type. | |
| using | const_reverse_iterator = typename Buffer< value_type >::const_reverse_iterator |
| Read-only reverse iterator type. | |
Public Member Functions | |
| size_type | size () const noexcept |
| Returns the number of stored elements. | |
| bool | empty () const noexcept |
| Reports whether no elements are stored. | |
| size_type | rank () const noexcept |
| Returns the number of logical dimensions. | |
| const Shape & | shape () const noexcept |
| Returns the logical shape metadata. | |
| const Shape & | strides () const noexcept |
| Returns the row-major stride metadata. | |
| pointer | data () noexcept |
| Returns a pointer to contiguous mutable element storage. | |
| const_pointer | data () const noexcept |
| Returns a pointer to contiguous read-only element storage. | |
| reference | front () |
| Returns the first element. | |
| const_reference | front () const |
| Returns the first element. | |
| reference | back () |
| Returns the final element. | |
| const_reference | back () const |
| Returns the final element. | |
| reference | operator[] (size_type index) noexcept |
| Returns an element without bounds checking. | |
| const_reference | operator[] (size_type index) const noexcept |
| Returns an element without bounds checking. | |
| reference | at (difference_type index) |
| Returns an element using checked, Python-style flat indexing. | |
| const_reference | at (difference_type index) const |
| Returns an element using checked, Python-style flat indexing. | |
| iterator | begin () noexcept |
| Returns a mutable iterator to the first element. | |
| const_iterator | begin () const noexcept |
| Returns a const iterator to the first element. | |
| const_iterator | cbegin () const noexcept |
| Returns a const iterator to the first element. | |
| iterator | end () noexcept |
| Returns a mutable iterator past the final element. | |
| const_iterator | end () const noexcept |
| Returns a const iterator past the final element. | |
| const_iterator | cend () const noexcept |
| Returns a const iterator past the final element. | |
| reverse_iterator | rbegin () noexcept |
| Returns a mutable reverse iterator to the final element. | |
| const_reverse_iterator | rbegin () const noexcept |
| Returns a const reverse iterator to the final element. | |
| const_reverse_iterator | crbegin () const noexcept |
| Returns a const reverse iterator to the final element. | |
| reverse_iterator | rend () noexcept |
| Returns the past-the-end mutable reverse iterator. | |
| const_reverse_iterator | rend () const noexcept |
| Returns the past-the-end const reverse iterator. | |
| const_reverse_iterator | crend () const noexcept |
| Returns the past-the-end const reverse iterator. | |
| void | fill (const_reference value) |
Assigns value to every stored element. | |
| void | swap (ArrayBase &other) noexcept |
Exchanges storage and layout metadata with other. | |
Static Public Member Functions | |
| static constexpr std::string_view | dtype () noexcept |
| Returns the canonical name of the stored element dtype. | |
Protected Member Functions | |
| ArrayBase (const Shape &shape) | |
Constructs value-initialized storage for shape. | |
| ArrayBase (const Shape &shape, const_reference value) | |
Constructs storage filled with value for shape. | |
| ArrayBase (const Shape &shape, Buffer< value_type > &&buffer) | |
Adopts an existing buffer for shape. | |
| template<typename IndexContainer > | |
| size_type | normalized_flat_offset (const IndexContainer &raw_indices) const |
| Converts checked signed multidimensional indices to a flat offset. | |
Shared owning storage and layout base for Stratax array containers.
ArrayBase keeps an element Buffer synchronized with Shape metadata and its derived row-major stride Shape. It supplies the common one-dimensional container interface used by Vector, Matrix, and Tensor; derived classes provide rank constraints and multidimensional indexing APIs.
The class is not directly constructible by users because its constructors are protected.
| T | Type of each stored array element. |
Definition at line 37 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::const_iterator = typename Buffer<value_type>::const_iterator |
Read-only contiguous random-access iterator type.
Definition at line 57 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::const_pointer = typename Buffer<value_type>::const_pointer |
Read-only element pointer type.
Definition at line 53 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::const_reference = typename Buffer<value_type>::const_reference |
Read-only element reference type.
Definition at line 49 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::const_reverse_iterator = typename Buffer<value_type>::const_reverse_iterator |
Read-only reverse iterator type.
Definition at line 61 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::difference_type = typename Buffer<value_type>::difference_type |
Signed type used for checked indices and iterator distances.
Definition at line 45 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::iterator = typename Buffer<value_type>::iterator |
Mutable contiguous random-access iterator type.
Definition at line 55 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::pointer = typename Buffer<value_type>::pointer |
Mutable element pointer type.
Definition at line 51 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::reference = typename Buffer<value_type>::reference |
Mutable element reference type.
Definition at line 47 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::reverse_iterator = typename Buffer<value_type>::reverse_iterator |
Mutable reverse iterator type.
Definition at line 59 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::size_type = typename Buffer<value_type>::size_type |
Unsigned type used for element counts and indices.
Definition at line 43 of file ArrayBase.hpp.
| using stratax::core::ArrayBase< T >::value_type = typename Buffer<T>::value_type |
Stored element type.
Definition at line 41 of file ArrayBase.hpp.
|
inlineexplicitprotected |
Constructs value-initialized storage for shape.
| shape | Logical shape of the resulting array. |
| Exceptions::DimensionError | If the element count or a stride cannot be represented by size_type. |
| std::bad_alloc | If element or metadata allocation fails. |
| Any | exception thrown while constructing a value_type element. |
Definition at line 218 of file ArrayBase.hpp.
|
inlineprotected |
Constructs storage filled with value for shape.
| shape | Logical shape of the resulting array. |
| value | Value copied into every element. |
| Exceptions::DimensionError | If the element count or a stride cannot be represented by size_type. |
| std::bad_alloc | If element or metadata allocation fails. |
| Any | exception thrown by value_type's copy constructor. |
Definition at line 234 of file ArrayBase.hpp.
|
inlineprotected |
Adopts an existing buffer for shape.
Ownership of buffer is transferred before its element count is validated. If validation fails, the adopted storage is released while unwinding construction.
| shape | Logical shape associated with the storage. |
| buffer | Element storage to adopt. |
| Exceptions::ShapeError | If buffer.size() != shape.elements(). |
| Exceptions::DimensionError | If the element count or a stride cannot be represented by size_type. |
| std::bad_alloc | If metadata allocation fails. |
Definition at line 255 of file ArrayBase.hpp.
|
inline |
Returns an element using checked, Python-style flat indexing.
| Exceptions::IndexError | If index is outside the valid range. |
Definition at line 150 of file ArrayBase.hpp.
|
inline |
Returns an element using checked, Python-style flat indexing.
| Exceptions::IndexError | If index is outside the valid range. |
Definition at line 157 of file ArrayBase.hpp.
|
inline |
Returns the final element.
| Exceptions::IndexError | If empty. |
Definition at line 119 of file ArrayBase.hpp.
|
inline |
Returns the final element.
| Exceptions::IndexError | If empty. |
Definition at line 129 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const iterator to the first element.
Definition at line 162 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a mutable iterator to the first element.
Definition at line 160 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const iterator to the first element.
Definition at line 164 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const iterator past the final element.
Definition at line 170 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const reverse iterator to the final element.
Definition at line 176 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns the past-the-end const reverse iterator.
Definition at line 182 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a pointer to contiguous read-only element storage.
nullptr when empty. Definition at line 95 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a pointer to contiguous mutable element storage.
nullptr when empty. Definition at line 89 of file ArrayBase.hpp.
|
inlinestaticconstexprnoexcept |
Returns the canonical name of the stored element dtype.
Definition at line 64 of file ArrayBase.hpp.
|
inlinenoexcept |
Reports whether no elements are stored.
Definition at line 73 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const iterator past the final element.
Definition at line 168 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a mutable iterator past the final element.
Definition at line 166 of file ArrayBase.hpp.
|
inline |
Assigns value to every stored element.
| value | Value copied into each element. |
| Any | exception thrown by value_type's copy-assignment operator. |
Definition at line 190 of file ArrayBase.hpp.
|
inline |
Returns the first element.
| Exceptions::IndexError | If empty. |
Definition at line 98 of file ArrayBase.hpp.
|
inline |
Returns the first element.
| Exceptions::IndexError | If empty. |
Definition at line 108 of file ArrayBase.hpp.
|
inlineprotected |
Converts checked signed multidimensional indices to a flat offset.
Each component is normalized independently against its corresponding dimension. Negative components count backward from the end. The selected exception context controls standardized rank and component diagnostics.
| IndexContainer | Sized, indexable container of signed indices. |
| raw_indices | One index per logical dimension. |
| context | Array category used to select standardized diagnostics. |
| Exceptions::RankError | If the number of indices differs from the rank. |
| Exceptions::IndexError | If an index component is out of bounds. |
Definition at line 283 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns an element without bounds checking.
index < size(). Definition at line 142 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns an element without bounds checking.
index < size(). Definition at line 140 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns the number of logical dimensions.
Definition at line 76 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a const reverse iterator to the final element.
Definition at line 174 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns a mutable reverse iterator to the final element.
Definition at line 172 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns the past-the-end const reverse iterator.
Definition at line 180 of file ArrayBase.hpp.
|
inlinenoexcept |
Returns the past-the-end mutable reverse iterator.
Definition at line 178 of file ArrayBase.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Exchanges storage and layout metadata with other.
Pointers, references, and iterators remain valid but refer to elements now owned by the other object.
| other | ArrayBase whose state is exchanged with this object. |
Definition at line 201 of file ArrayBase.hpp.