Theoretica
A C++ numerical and automatic mathematical library
|
A sequential iterator for matrices. More...
#include <mat.h>
Public Types | |
using | iterator_category = std::forward_iterator_tag |
using | value_type = matrix_element_t< Matrix > |
using | pointer = value_type * |
using | reference = value_type & |
Public Member Functions | |
mat_iterator (Matrix &matrix, size_t row=0, size_t col=0) | |
Constructs an iterator for a matrix, optionally starting at a specified row and column. More... | |
ReturnType | operator* () |
Dereferences the iterator to access the current matrix element. More... | |
mat_iterator & | operator++ () |
Advances the iterator to the next element in row-major order. More... | |
size_t | row_index () |
Retrieves the current row index of the iterator. More... | |
size_t | col_index () |
Retrieves the current column index of the iterator. More... | |
bool | operator== (const mat_iterator &other) const |
Equality operator to compare two iterators. More... | |
bool | operator!= (const mat_iterator &other) const |
Inequality operator to compare two iterators. More... | |
A sequential iterator for matrices.
A const iterator may be constructed by specifying both typenames Matrix and ReturnType as const.
|
inline |
Constructs an iterator for a matrix, optionally starting at a specified row and column.
matrix | Reference to the matrix to iterate over. |
row | Initial row index for the iterator (default is 0). |
col | Initial column index for the iterator (default is 0). |
Constructs an iterator that points to the specified initial position within the matrix. If no row and column are specified, the iterator starts at the matrix's top-left corner (0, 0).
|
inline |
Retrieves the current column index of the iterator.
size_t
.
|
inline |
Inequality operator to compare two iterators.
other | Another iterator to compare with. |
true
if the iterators do not point to the same matrix element; otherwise, false
.
|
inline |
Dereferences the iterator to access the current matrix element.
Provides direct access to the element at the iterator's current position.
|
inline |
Advances the iterator to the next element in row-major order.
Moves the iterator one element forward within the matrix. When the end of a row is reached, it continues to the first element of the next row.
|
inline |
Equality operator to compare two iterators.
other | Another iterator to compare with. |
true
if the iterators point to the same matrix element; otherwise, false
.
|
inline |
Retrieves the current row index of the iterator.
size_t
.