Compute Library
 22.11
WindowIterator< L > Class Template Reference

Iterate over a portion of a Window. More...

#include <WindowIterator.h>

Public Member Functions

 WindowIterator (const Window &w, const Coordinates &start, const Coordinates &end, L &&lambda_function)
 Construct a WindowIterator object. More...
 
template<typename M >
void iterate_3D (M &&on_new_row_size)
 Iterate over the lowest 3 dimensions of the window. More...
 
template<typename M >
void iterate_2D (M &&on_new_row_size)
 Iterate over the lowest 2 dimensions of the window. More...
 
void set_step (size_t dim, int step)
 Change the step used for the iteration. More...
 
const Coordinatesend_position () const
 Returns the coordinates in absolute coordinates of the end position. More...
 

Detailed Description

template<typename L>
class arm_compute::WindowIterator< L >

Iterate over a portion of a Window.

Definition at line 144 of file WindowIterator.h.

Constructor & Destructor Documentation

◆ WindowIterator()

WindowIterator ( const Window w,
const Coordinates start,
const Coordinates end,
L &&  lambda_function 
)
inline

Construct a WindowIterator object.

Parameters
[in]wWindow to use for the iteration
[in]startWhere to start iterating from (In Window coordinates)
[in]endWhere to stop iterating (In Window coordinates).
[in]lambda_functionLambda function to call for every iteration between start and end. (It will be called last for end - 1)

Definition at line 154 of file WindowIterator.h.

155  : _lambda_function(std::move(lambda_function)),
156  _position(convert_window_coord_to_position(w, start)),
158  _w(w)
159  {
160  }
SimpleTensor< float > w
Definition: DFT.cpp:156
Coordinates convert_window_coord_to_position(const Window &w, const Coordinates &offset)
Convert an offset in window steps into absolute coordinates.
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

Member Function Documentation

◆ end_position()

const Coordinates& end_position ( ) const
inline

Returns the coordinates in absolute coordinates of the end position.

Returns
End position coordinates.

Definition at line 205 of file WindowIterator.h.

206  {
207  return _end;
208  }

◆ iterate_2D()

void iterate_2D ( M &&  on_new_row_size)
inline

Iterate over the lowest 2 dimensions of the window.

Parameters
[in]on_new_row_sizeCallback to be called before lambda_function every time the width of the row processed changes.

Definition at line 184 of file WindowIterator.h.

185  {
186  iterate_2D_internal(on_new_row_size, _end.x(), _end.y());
187  }
T x() const
Alias to access the size of the first dimension.
Definition: Dimensions.h:87
T y() const
Alias to access the size of the second dimension.
Definition: Dimensions.h:92

◆ iterate_3D()

void iterate_3D ( M &&  on_new_row_size)
inline

Iterate over the lowest 3 dimensions of the window.

Parameters
[in]on_new_row_sizeCallback to be called before lambda_function every time the width of the row processed changes.

Definition at line 166 of file WindowIterator.h.

167  {
168  while(_end.z() != _position.z())
169  {
170  iterate_2D_internal(on_new_row_size, _w.x().end() - _w.x().step(), _w.y().end() - _w.y().step());
171  _position[2] += _w.z().step();
172  _position[1] = _w.y().start();
173  _position[0] = _w.x().start();
174  }
175  // Left over:
176  iterate_2D(on_new_row_size);
177  }
constexpr int step() const
Return the step of the dimension.
Definition: Window.h:107
constexpr const Dimension & z() const
Alias to access the third dimension of the window.
Definition: Window.h:177
T z() const
Alias to access the size of the third dimension.
Definition: Dimensions.h:97
void iterate_2D(M &&on_new_row_size)
Iterate over the lowest 2 dimensions of the window.
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
Definition: Window.h:168
constexpr int end() const
Return the end of the dimension.
Definition: Window.h:102
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:97
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
Definition: Window.h:159

◆ set_step()

void set_step ( size_t  dim,
int  step 
)
inline

Change the step used for the iteration.

Note
Does not affect the start and end points.
Parameters
[in]dimDimension to change
[in]stepNew step to use for the given dimension.

Definition at line 196 of file WindowIterator.h.

197  {
198  _w.set_dimension_step(dim, step);
199  }
void set_dimension_step(size_t dimension, int step)
Set the step of a given dimension.
Definition: Window.inl:167
constexpr int step
Definition: fp32.cpp:35

The documentation for this class was generated from the following file: