pbpt
|
A non-owning, mutable view/proxy into a sub-region of another Matrix. More...
#include <matrix.hpp>
Public Types | |
using | RowView = VectorView<T, ViewC> |
using | ColView = VectorView<T, ViewR> |
Public Member Functions | |
constexpr | MatrixView (const Matrix< T, R, C > &original, int row_start, int col_start) |
Constructs a view from a Matrix instance. | |
constexpr const T & | at (int r, int c) const |
Provides read-only access to an element of the view. | |
constexpr const RowView | operator[] (int r) const |
Returns a non-owning, read-only view of a row. | |
constexpr RowView | operator[] (int r) |
Returns a non-owning, read-only view of a row. | |
constexpr const RowView | row (int r) const |
Returns a non-owning, read-only view of a row. | |
constexpr ColView | col (int c) |
Returns a non-owning, mutable view of a column. | |
constexpr Matrix< T, ViewR, ViewC > | to_matrix () const |
Converts the view into a new, owning Matrix instance. | |
constexpr T & | at (int r, int c) |
Provides mutable access to an element of the view. | |
constexpr MatrixView & | operator= (const Matrix< T, ViewR, ViewC > &other) |
Assigns another matrix's content to the region represented by this view. | |
void | apply (const std::function< void(T &, int, int)> &func) |
Applies a function to each element of the matrix. |
Protected Attributes | |
const Matrix< T, R, C > & | m_original |
A const reference to the original matrix. | |
int | m_row_start {} |
The starting row of the view in the original matrix's coordinate system. | |
int | m_col_start {} |
The starting column of the view in the original matrix's coordinate system. |
A non-owning, mutable view/proxy into a sub-region of another Matrix.
|
inlineconstexpr |
Constructs a view from a Matrix instance.
original | The matrix to view. |
row_start | The starting row index of the view. |
col_start | The starting column index of the view. |
|
inline |
Applies a function to each element of the matrix.
func | The function to apply. |
|
inlineconstexpr |
Provides mutable access to an element of the view.
r | The row index relative to the view. |
c | The column index relative to the view. |
|
inlineconstexpr |
Provides read-only access to an element of the view.
r | The row index relative to the view. |
c | The column index relative to the view. |
|
inlineconstexpr |
Assigns another matrix's content to the region represented by this view.
other | The matrix to copy from. |
|
inlineconstexpr |
Converts the view into a new, owning Matrix instance.
This performs a copy of the elements from the viewed region.