template<
typename T = double>
class qip::Array< T >
N-dimensional array with arithmetic operators.
Stores data in a flat std::vector; indices are computed from the shape. Element-wise arithmetic (+, -, *, /) is provided between arrays of identical shape, and between an array and its element type (see operator+=, etc.). Row and column views (ArrayView) are available for 2D arrays.
|
| template<typename... Args> |
| | Array (std::size_t first, Args... rest) |
| | Constructs an N-dimensional array with the given dimension sizes.
|
| |
| template<typename... Args> |
| void | resize (std::size_t first, Args... rest) |
| | Resizes the array. Note: invalidates all underlying data.
|
| |
| std::size_t | size () const |
| | Returns the total number of elements.
|
| |
| std::size_t | size (std::size_t dim) const |
| | Returns the size of a specific dimension.
|
| |
| std::size_t | dimensions () const |
| | Returns the number of dimensions.
|
| |
| const std::vector< std::size_t > & | shape () const |
| | Returns the shape (sizes of all dimensions) of the array.
|
| |
| template<typename... Args> |
| T & | at (std::size_t first, Args... rest) |
| | Access element with bounds checking.
|
| |
| template<typename... Args> |
| T | at (std::size_t first, Args... rest) const |
| | Const access to element with bounds checking.
|
| |
| template<typename... Args> |
| T & | operator() (std::size_t first, Args... rest) |
| | Access element without bounds checking.
|
| |
| template<typename... Args> |
| T | operator() (std::size_t first, Args... rest) const |
| | Const access to element without bounds checking.
|
| |
| T * | data () |
| | Pointer to the first element of the underlying contiguous storage.
|
| |
|
const T * | data () const |
| |
| const std::vector< T > & | vector () const |
| | Const reference to the underlying flat data vector.
|
| |
| std::size_t | rows () const |
| | Number of rows (equivalent to size(0)).
|
| |
| std::size_t | cols () const |
| | Number of columns (equivalent to size(1)).
|
| |
| ArrayView< T > | row (std::size_t i) |
| | A view onto the ith row. Only defined for 2D arrays.
|
| |
|
ArrayView< const T > | row (std::size_t i) const |
| |
| ArrayView< T > | col (std::size_t j) |
| | A view onto the jth column. Only defined for 2D arrays.
|
| |
|
ArrayView< const T > | col (std::size_t j) const |
| |
| auto | begin () |
| | Iterator to the beginning.
|
| |
| auto | cbegin () const |
| | Constant iterator to the beginning.
|
| |
| auto | end () |
| | Iterator to the end.
|
| |
| auto | cend () const |
| | Constant iterator to the end.
|
| |
| auto | rbegin () |
| | Reverse iterator to the beginning of the data.
|
| |
| auto | crbegin () const |
| | Constant reverse iterator to the beginning of the data.
|
| |
| auto | rend () |
| | Reverse iterator to the end of the data.
|
| |
| auto | crend () const |
| | Constant reverse iterator to the end of the data.
|
| |
| Array< T > & | operator+= (const Array< T > &other) |
| | Element-wise arithmetic between arrays of identical shape (+, -, *, /).
|
| |
|
Array< T > & | operator-= (const Array< T > &other) |
| |
|
Array< T > & | operator*= (const Array< T > &other) |
| |
|
Array< T > & | operator/= (const Array< T > &other) |
| |
| Array< T > & | operator+= (const T &t) |
| | Element-wise scalar arithmetic (+, -, *, /).
|
| |
|
Array< T > & | operator-= (const T &t) |
| |
|
Array< T > & | operator*= (const T &t) |
| |
|
Array< T > & | operator/= (const T &t) |
| |