|
Stratax 0.3.1
|
One-dimensional owning array of numeric values. More...
#include <Vector.hpp>


Public Types | |
| using | value_type = typename core::ArrayBase< T >::value_type |
| Stored element type inherited from ArrayBase. | |
| using | size_type = typename core::ArrayBase< T >::size_type |
| Unsigned type used for element counts and indices. | |
| using | difference_type = typename core::ArrayBase< T >::difference_type |
| Signed type used for checked indices and iterator distances. | |
| using | reference = typename core::ArrayBase< T >::reference |
| Mutable element reference type. | |
| using | const_reference = typename core::ArrayBase< T >::const_reference |
| Read-only element reference type. | |
| using | pointer = typename core::ArrayBase< T >::pointer |
| Mutable element pointer type. | |
| using | const_pointer = typename core::ArrayBase< T >::const_pointer |
| Read-only element pointer type. | |
| using | iterator = typename core::ArrayBase< T >::iterator |
| Mutable contiguous random-access iterator type. | |
| using | const_iterator = typename core::ArrayBase< T >::const_iterator |
| Read-only contiguous random-access iterator type. | |
| using | reverse_iterator = typename core::ArrayBase< T >::reverse_iterator |
| Mutable reverse iterator type. | |
| using | const_reverse_iterator = typename core::ArrayBase< T >::const_reverse_iterator |
| Read-only reverse iterator type. | |
Public Types inherited from stratax::core::ArrayBase< T > | |
| 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 | |
| Vector (size_type size) | |
Constructs a value-initialized vector with size elements. | |
| Vector (const core::Shape &shape) | |
| Constructs a value-initialized vector from a rank-one shape. | |
| Vector (size_type size, const_reference value) | |
Constructs a vector containing size copies of value. | |
| Vector (std::initializer_list< value_type > list) | |
| Constructs a vector by copying an initializer list. | |
| Vector () | |
| Constructs an empty rank-one vector. | |
| void | swap (Vector &other) noexcept |
Exchanges storage and layout metadata with other. | |
Public Member Functions inherited from stratax::core::ArrayBase< T > | |
| 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. | |
Friends | |
| void | swap (Vector &lhs, Vector &rhs) noexcept |
| Exchanges two vectors using argument-dependent lookup. | |
Additional Inherited Members | |
Static Public Member Functions inherited from stratax::core::ArrayBase< T > | |
| static constexpr std::string_view | dtype () noexcept |
| Returns the canonical name of the stored element dtype. | |
Protected Member Functions inherited from stratax::core::ArrayBase< T > | |
| 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. | |
One-dimensional owning array of numeric values.
Forward declaration of the rank-one dtype array container.
Vector specializes core::ArrayBase for rank-one data. Elements are stored contiguously, while the inherited shape and strides describe a row-major layout whose sole stride is one. The class inherits flat checked and unchecked access, iteration, metadata access, and modifiers from ArrayBase.
| T | Element type satisfying the DType concept. |
Definition at line 43 of file Vector.hpp.
| using stratax::container::Vector< T >::const_iterator = typename core::ArrayBase<T>::const_iterator |
Read-only contiguous random-access iterator type.
Definition at line 63 of file Vector.hpp.
| using stratax::container::Vector< T >::const_pointer = typename core::ArrayBase<T>::const_pointer |
Read-only element pointer type.
Definition at line 59 of file Vector.hpp.
| using stratax::container::Vector< T >::const_reference = typename core::ArrayBase<T>::const_reference |
Read-only element reference type.
Definition at line 55 of file Vector.hpp.
| using stratax::container::Vector< T >::const_reverse_iterator = typename core::ArrayBase<T>::const_reverse_iterator |
Read-only reverse iterator type.
Definition at line 67 of file Vector.hpp.
| using stratax::container::Vector< T >::difference_type = typename core::ArrayBase<T>::difference_type |
Signed type used for checked indices and iterator distances.
Definition at line 51 of file Vector.hpp.
| using stratax::container::Vector< T >::iterator = typename core::ArrayBase<T>::iterator |
Mutable contiguous random-access iterator type.
Definition at line 61 of file Vector.hpp.
| using stratax::container::Vector< T >::pointer = typename core::ArrayBase<T>::pointer |
Mutable element pointer type.
Definition at line 57 of file Vector.hpp.
| using stratax::container::Vector< T >::reference = typename core::ArrayBase<T>::reference |
Mutable element reference type.
Definition at line 53 of file Vector.hpp.
| using stratax::container::Vector< T >::reverse_iterator = typename core::ArrayBase<T>::reverse_iterator |
Mutable reverse iterator type.
Definition at line 65 of file Vector.hpp.
| using stratax::container::Vector< T >::size_type = typename core::ArrayBase<T>::size_type |
Unsigned type used for element counts and indices.
Definition at line 49 of file Vector.hpp.
| using stratax::container::Vector< T >::value_type = typename core::ArrayBase<T>::value_type |
Stored element type inherited from ArrayBase.
Definition at line 47 of file Vector.hpp.
|
inlineexplicit |
Constructs a value-initialized vector with size elements.
| size | Number of elements to allocate. |
| std::bad_alloc | If storage allocation fails. |
| Any | exception thrown while value-initializing a value_type. |
Definition at line 76 of file Vector.hpp.
|
inlineexplicit |
Constructs a value-initialized vector from a rank-one shape.
| shape | Shape whose only dimension determines the vector size. |
| Exceptions::RankError | If shape.rank() != 1. |
| std::bad_alloc | If storage allocation fails. |
| Any | exception thrown while value-initializing a value_type. |
Definition at line 88 of file Vector.hpp.
|
inline |
Constructs a vector containing size copies of value.
| size | Number of elements to allocate. |
| value | Value copied into each element. |
| std::bad_alloc | If storage allocation fails. |
| Any | exception thrown by value_type's copy constructor. |
Definition at line 105 of file Vector.hpp.
|
inline |
Constructs a vector by copying an initializer list.
| list | Elements in vector order. |
| std::bad_alloc | If storage allocation fails. |
| Any | exception thrown by value_type's copy constructor. |
Definition at line 116 of file Vector.hpp.
|
inline |
Constructs an empty rank-one vector.
The resulting shape is {0} rather than a rank-zero shape.
Definition at line 127 of file Vector.hpp.
|
inlinenoexcept |
Exchanges storage and layout metadata with other.
| other | Vector to exchange with this vector. |
Definition at line 134 of file Vector.hpp.
Exchanges two vectors using argument-dependent lookup.
| lhs | First vector. |
| rhs | Second vector. |
Definition at line 145 of file Vector.hpp.