ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw::misc::matrix::IndexIterator Class Reference

Class to iterate Callable with Index of matrix. More...

#include <IndexIterator.h>

Public Member Functions

 IndexIterator (const Shape &shape)
 Construct IndexIterator object with Shape of matrix.
 
template<typename Callable >
IndexIteratoriter (Callable cb)
 Call a function iterated.
 

Detailed Description

Class to iterate Callable with Index of matrix.

Definition at line 38 of file IndexIterator.h.

Constructor & Destructor Documentation

◆ IndexIterator()

nnfw::misc::matrix::IndexIterator::IndexIterator ( const Shape shape)
inline

Construct IndexIterator object with Shape of matrix.

Parameters
[in]shapeShape reference of matrix

Definition at line 45 of file IndexIterator.h.

45 : _shape{shape}
46 {
47 // DO NOTHING
48 }

Member Function Documentation

◆ iter()

template<typename Callable >
IndexIterator & nnfw::misc::matrix::IndexIterator::iter ( Callable  cb)
inline

Call a function iterated.

Parameters
[in]cbA callback function
Returns
Current IndexIterator object

Definition at line 56 of file IndexIterator.h.

57 {
58 for (uint32_t row = 0; row < _shape.H; ++row)
59 {
60 for (uint32_t col = 0; col < _shape.W; ++col)
61 {
62 cb(row, col);
63 }
64 }
65
66 return (*this);
67 }

References nnfw::misc::matrix::Shape::H, and nnfw::misc::matrix::Shape::W.

Referenced by nnfw::misc::matrix::operator<<().


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