|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Iterator for traversing matrix elements. More...
#include <tpl_dynMat.H>
Public Types | |
| using | Set_Type = DynMatrix< T > |
| The container type this iterator operates on. | |
Public Member Functions | |
| Iterator (const DynMatrix< T > &mat) noexcept | |
| Construct an iterator for a matrix. | |
| bool | has_curr () const noexcept |
| Check if iterator has a current element. | |
| const T & | get_curr_ne () const noexcept |
| Get the current element without bounds checking. | |
| const T & | get_curr () const |
| Get the current element. | |
| void | next_ne () noexcept |
| Advance to the next element without bounds checking. | |
| void | next () |
| Advance to the next element. | |
| size_t | get_row () const noexcept |
| Get the current row index. | |
| size_t | get_col () const noexcept |
| Get the current column index. | |
| void | reset () noexcept |
| Reset iterator to the beginning. | |
Private Attributes | |
| const DynMatrix * | mat_ptr = nullptr |
| size_t | curr_idx = 0 |
Iterator for traversing matrix elements.
Provides forward iteration over all matrix positions in row-major order. The iterator visits positions (0,0), (0,1), ..., (0,m-1), (1,0), ...
Definition at line 598 of file tpl_dynMat.H.
The container type this iterator operates on.
Definition at line 606 of file tpl_dynMat.H.
|
inlinenoexcept |
Construct an iterator for a matrix.
| [in] | mat | The matrix to iterate over. |
Definition at line 612 of file tpl_dynMat.H.
|
inlinenoexcept |
Get the current column index.
Definition at line 673 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx, Aleph::DynMatrix< T >::m, and Aleph::DynMatrix< T >::Iterator::mat_ptr.
Get the current element.
| std::overflow_error | If iterator is exhausted. |
Definition at line 638 of file tpl_dynMat.H.
References ah_overflow_error_unless, Aleph::DynMatrix< T >::Iterator::get_curr_ne(), and Aleph::DynMatrix< T >::Iterator::has_curr().
|
inlinenoexcept |
Get the current element without bounds checking.
Definition at line 628 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx, Aleph::DynMatrix< T >::Iterator::mat_ptr, and Aleph::DynMatrix< T >::read_array_entry().
Referenced by Aleph::DynMatrix< T >::Iterator::get_curr().
|
inlinenoexcept |
Get the current row index.
Definition at line 664 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx, Aleph::DynMatrix< T >::m, and Aleph::DynMatrix< T >::Iterator::mat_ptr.
|
inlinenoexcept |
Check if iterator has a current element.
Definition at line 619 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx, Aleph::DynMatrix< T >::Iterator::mat_ptr, and Aleph::DynMatrix< T >::size().
Referenced by Aleph::DynMatrix< T >::Iterator::get_curr(), and Aleph::DynMatrix< T >::Iterator::next().
|
inline |
Advance to the next element.
| std::overflow_error | If iterator is already exhausted. |
Definition at line 653 of file tpl_dynMat.H.
References ah_overflow_error_unless, Aleph::DynMatrix< T >::Iterator::has_curr(), and Aleph::DynMatrix< T >::Iterator::next_ne().
|
inlinenoexcept |
Advance to the next element without bounds checking.
Definition at line 647 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx.
Referenced by Aleph::DynMatrix< T >::Iterator::next().
|
inlinenoexcept |
Reset iterator to the beginning.
Definition at line 680 of file tpl_dynMat.H.
References Aleph::DynMatrix< T >::Iterator::curr_idx.
|
private |
Definition at line 601 of file tpl_dynMat.H.
Referenced by Aleph::DynMatrix< T >::Iterator::get_col(), Aleph::DynMatrix< T >::Iterator::get_curr_ne(), Aleph::DynMatrix< T >::Iterator::get_row(), Aleph::DynMatrix< T >::Iterator::has_curr(), Aleph::DynMatrix< T >::Iterator::next_ne(), and Aleph::DynMatrix< T >::Iterator::reset().
Definition at line 600 of file tpl_dynMat.H.
Referenced by Aleph::DynMatrix< T >::Iterator::get_col(), Aleph::DynMatrix< T >::Iterator::get_curr_ne(), Aleph::DynMatrix< T >::Iterator::get_row(), and Aleph::DynMatrix< T >::Iterator::has_curr().