|
| line_NDIterator (T *buffer, const std::vector< int > &dims) |
|
| line_NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< int > &strides, bool optimize_direction=false) |
| the optional "optimize_direction" parameter allows the iterator to find a contiguous direction (with a stride == 1) and use it as the line dimension. More...
|
|
| line_NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< size_t > &strides, bool optimize_direction=false) |
|
| line_NDIterator (T *buffer, const std::vector< int > &dims, const std::vector< long > &strides, bool optimize_direction=false) |
|
T & | operator* () const |
|
T * | operator-> () const |
|
void | inc_line_ptr (T *&p) const |
| increment a "line" pointer (advancing through the line) More...
|
|
void | inc_line_ptr (const T *&p) const |
| increment a "line" pointer (advancing through the line) More...
|
|
long | line_length () const |
| line_size * line stride: end of line More...
|
|
| line_NDIterator_base (const std::vector< int > &dims) |
|
| line_NDIterator_base (const std::vector< int > &dims, const std::vector< int > &strides, bool optimize_direction=false) |
|
| line_NDIterator_base (const std::vector< int > &dims, const std::vector< size_t > &strides, bool optimize_direction=false) |
|
| line_NDIterator_base (const std::vector< int > &dims, const std::vector< long > &strides, bool optimize_direction=false) |
|
NDIterator_base & | operator++ () |
|
int | line_size () const |
|
int | line_direction () const |
|
bool | is_contiguous () 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::line_NDIterator< T >
N-dimensional array line iterator.
Iterates over every "line" of a N-D array, using strides. The "lines" are arrays over the smallest dimension of the array. Thus the iterator iterates over all dimensions but the smallest one. This allows to optimize code iterating directly on the smallest dimension, which is much more efficient than the regular NDIterator: for a very simple item operation using a line_NDIterator instead of a NDIterator can be about 20 times faster.
float *data;
std::vector<int> dimensions;
std::vector<int> strdes;
float sum = 0.;
line_NDIterator<float> it( data, dimensions, strides );
float *p, *pp;
for( ; !it.ended(); ++it )
{
p = &*it;
for( pp=p + it.line_length(); p!=pp; it.inc_line_ptr( p ) )
sum += *p;
}
Definition at line 200 of file nditerator.h.