|
ndarray
NumPy-friendly multidimensional arrays in C++
|
A fixed-size 1D array class. More...
#include <Vector.h>
Public Member Functions | |
| size_type | size () const |
| Return the size of the Vector. | |
| size_type | max_size () const |
| Return the size of the Vector. | |
| bool | empty () const |
| iterator | begin () |
| Return an iterator to the beginning of the Vector. | |
| const_iterator | begin () const |
| Return a const_iterator to the beginning of the Vector. | |
| iterator | end () |
| Return an iterator to the end of the Vector. | |
| const_iterator | end () const |
| Return a const_iterator to the end of the Vector. | |
| reverse_iterator | rbegin () |
| Return a reverse_iterator to the beginning of the reversed Vector. | |
| const_reverse_iterator | rbegin () const |
| Return a const_reverse_iterator to the beginning of the reversed Vector. | |
| reverse_iterator | rend () |
| Return a reverse_iterator to the end of the reversed Vector. | |
| const_reverse_iterator | rend () const |
| Return a const_reverse_iterator to the end of the reversed Vector. | |
| reference | front () |
| Return a reference to the first element. | |
| reference | back () |
| Return a reference to the last element. | |
| const_reference | front () const |
| Return a const_reference to the first element. | |
| const_reference | back () const |
| Return a const_reference to the last element. | |
| reference | operator[] (int i) |
| Return a reference to the element with the given index. | |
| const_reference | operator[] (int i) const |
| Return a const_reference to the element with the given index. | |
| template<int Start, int Stop> | |
| Vector< T, Stop-Start > | getRange () const |
| Create a new Vector that is a subset of this. | |
| template<int M> | |
| Vector< T, M > | first () const |
| Create a new Vector from the first M elements of this. | |
| template<int M> | |
| Vector< T, M > | last () const |
| Create a new Vector from the last M elements of this. | |
| Vector () | |
| Default constructor. | |
| Vector (T scalar) | |
| Construct with copies of a scalar. | |
| template<typename U > | |
| Vector (Vector< U, N > const &other) | |
| Converting copy constructor. | |
| bool | operator== (Vector const &other) const |
| Return true if elements of other are equal to the elements of this. | |
| bool | operator!= (Vector const &other) const |
| Return false if any elements of other are not equal to the elements of this. | |
| T | sum () const |
| Return the sum of all elements. | |
| T | product () const |
| Return the product of all elements. | |
| Vector | reverse () const |
| Return a Vector with the elements reversed. | |
| template<typename U > | |
| Vector< U, N > | cast () const |
| Cast the vector element-wise to another type. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator= (Vector< U, N > const &other) |
| Augmented = assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator= (U scalar) |
| Augmented = assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator+= (Vector< U, N > const &other) |
| Augmented += assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator+= (U scalar) |
| Augmented += assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator-= (Vector< U, N > const &other) |
| Augmented -= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator-= (U scalar) |
| Augmented -= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator*= (Vector< U, N > const &other) |
| Augmented *= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator*= (U scalar) |
| Augmented *= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator/= (Vector< U, N > const &other) |
| Augmented /= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator/= (U scalar) |
| Augmented /= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator%= (Vector< U, N > const &other) |
| Augmented %= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator%= (U scalar) |
| Augmented %= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator&= (Vector< U, N > const &other) |
| Augmented &= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator&= (U scalar) |
| Augmented &= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator^= (Vector< U, N > const &other) |
| Augmented ^= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator^= (U scalar) |
| Augmented ^= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator|= (Vector< U, N > const &other) |
| Augmented |= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator|= (U scalar) |
| Augmented |= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator<<= (Vector< U, N > const &other) |
| Augmented <<= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator<<= (U scalar) |
| Augmented <<= assignment from a scalar. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator>>= (Vector< U, N > const &other) |
| Augmented >>= assignment from another vector. | |
| template<typename U > | |
| boost::enable_if< boost::is_convertible< U, T >, Vector & >::type | operator>>= (U scalar) |
| Augmented >>= assignment from a scalar. | |
Public Attributes | |
| T | elems [N] |
Friends | |
| std::ostream & | operator<< (std::ostream &os, Vector< T, N > const &obj) |
| Stream output. | |
A fixed-size 1D array class.
Vector is primarily used as the data type for the shape (with T==Size) and strides (with T==Offset) attributes of Array.
Vector is implemented almost exactly as a non-aggregate boost::array, but with the addition of mathematical operators and a few other utility functions.
|
inline |
Default constructor.
Initializes the elements to zero.
|
inline |