ivl 679
|
Multi-dimensional array of type T. More...
#include <array_nd.hpp>
Inherits ivl::array_common_base< C >.
Public Types | |
typedef types::t_true | has_1d_parenthesis |
types that specify the defined parenthesis operators for this class | |
typedef const array< size_t, tiny > & | size_nd_ref_type |
return type of size_nd in that data-specific class | |
typedef array< size_t, tiny > | size_type |
parameter of resize, in each class of the hierarchy | |
typedef array< size_t, tiny > | stride_ref_type |
return type of stride in that data-specific class | |
Public Member Functions | |
base_class & | base () |
get base class | |
template<class S > | |
types::best_iterator< array_nd > ::type::reference | operator() (const array< size_t, S > &indx) |
template<class S > | |
array_nd::const_iterator::reference | operator() (const array< size_t, S > &indx) const |
constructors | |
array_nd () | |
Default constructor. | |
array_nd (A &a, const I &idx) | |
Construct by defining original array and index array references. | |
array_nd (const this_type &a) | |
Copy constructor. | |
filler constructors | |
array_nd (size_t count) | |
array_nd (size_t count, const T &s) | |
array_nd (size_t count, const T *data) | |
template<class S > | |
array_nd (const array< size_t, S > &sz) | |
template<class S > | |
array_nd (const array< size_t, S > &sz, const T &s) | |
template<class S > | |
array_nd (const array< size_t, S > &sz, const T *ptr) | |
template<class S , class J , class D > | |
array_nd (const array< size_t, S > &sz, const array< J, D > &a) | |
template<class J , class S > | |
array_nd (const array_nd< J, S > &a) | |
Size functions (multidimensional) | |
size_nd_ref_type | size_nd () const |
Get the size for each dimension. | |
size_t | size_nd (size_t d) const |
Get the size for a specific dimension. | |
stride_ref_type | stride () const |
size_type | size () const |
Get the size for each dimension. | |
size_t | size (size_t d) const |
Get the size for a specific dimension. | |
size_t | ndims () const |
Get the number of dimensions. | |
Assignment Operators | |
template<class K > | |
derived_type & | operator= (const K &k) |
this_type & | operator= (const this_type &in) |
C++ copy-constructor. |
Multi-dimensional array of type T.
This structure is used to define a multidimensional array of type T. The number of dimensions can be specified when constructing an object and can be altered anytime by using methods like resize(const size_array &, const T).
The simpliest way to access an array_nd element is by using operator() and specifying the offset on each dimension, like this:
int i = a(2, 3, 2)
An array_nd inherites all the functionality the array class provides, which means that it can also be indexed as an one-dimensional array using the array subscript operator: []. Keep in mind that in array_nd the elements are stored in column-major order like Fortran and Matlab and not like C. So, the offset is computed like this:
offset = row + column*NUMROWS
array_nd::const_iterator::reference ivl::array_nd< T, data::subarray< A, I, DERIVED_INFO > >::operator() | ( | const array< size_t, S > & | indx | ) | const [inline] |
Selects a single, const element of the array, using a size_array for the coordinates.
types::best_iterator<array_nd>::type::reference ivl::array_nd< T, data::subarray< A, I, DERIVED_INFO > >::operator() | ( | const array< size_t, S > & | indx | ) | [inline] |
Selects a single, mutable element of the array, using a size_array for the coordinates.