|
| NDIterator (T *buffer, const std::vector< int > &dims) |
|
| NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< int > &strides) |
|
| NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< size_t > &strides) |
|
| NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< long > &strides) |
|
T & | operator* () const |
|
| NDIterator_base (const std::vector< int > &dims) |
|
| NDIterator_base (const std::vector< int > &dims, const std::vector< int > &strides) |
|
| NDIterator_base (const std::vector< int > &dims, const std::vector< size_t > &strides) |
|
| NDIterator_base (const std::vector< int > &dims, const std::vector< long > &strides) |
|
const std::vector< int > & | position () const |
|
uint64_t | offset () const |
|
NDIterator_base & | operator++ () |
|
bool | ended () const |
|
void | reset () |
|
template<typename T>
class carto::NDIterator< T >
N-dimensional array iterator.
Iterates over every element of a N-D array, using strides. The iterator is used more or less like a pointer:
float *data;
std::vector<int> dimensions;
std::vector<int> strdes;
float sum = 0.;
NDIterator<float> it( data, dimensions, strides );
for( ; !it.ended(); ++it )
sum += *it;
Note that the NDIterator is somewhat sub-optimal since it has to test, at each increment, the bounds of each dimension. In many cases it is possible to lowerage the overhead by implementing an ad-hoc loop for the smallest dimension, and using a line_NDIterator on higher dimensions.
Definition at line 118 of file nditerator.h.