template<typename T>
class LinAlg::Matrix_view< T >
Non-owning 2D view onto a Matrix.
Provides row/column element access to an existing matrix buffer without ownership or resize capability. Supports both mutable (Matrix_view<T>) and read-only (Matrix_view<const T>) access.
Implicitly constructible from Matrix<T> (mutable view) and from const Matrix<T> (const view only).
- Note
- Iterators (
begin()/end()) yield raw pointers into the flat buffer.
|
| | Matrix_view (T *data, std::size_t rows, std::size_t cols) |
| | Construct from raw pointer and dimensions (no ownership)
|
| |
| | Matrix_view (Matrix< std::remove_const_t< T > > &m) |
| | Implicit conversion from mutable Matrix (works for both mutable and const view)
|
| |
| template<typename U = T, typename = std::enable_if_t<std::is_const_v<U>>> |
| | Matrix_view (const Matrix< std::remove_const_t< T > > &m) |
| | Implicit conversion from const Matrix (only for Matrix_view<const T>)
|
| |
| std::size_t | rows () const |
| | Return rows [major index size].
|
| |
| std::size_t | cols () const |
| | Return columns [minor index size].
|
| |
| std::size_t | size () const |
| | Return rows*columns [total array size].
|
| |
| bool | empty () const |
| | Bool - is empty? (same as size==0)
|
| |
| T * | data () |
| | Raw pointer to first element, mutable.
|
| |
| const T * | data () const |
| | Raw pointer to first element, const.
|
| |
| T * | operator[] (std::size_t i) |
| | [] index access (no range checking). [i] returns pointer to ith row, mutable
|
| |
| const T * | operator[] (std::size_t i) const |
| | [] index access (no range checking). [i] returns const pointer to ith row
|
| |
| T & | at (std::size_t i, std::size_t j) |
| | at(i,j): element access with range checking, mutable
|
| |
| T | at (std::size_t i, std::size_t j) const |
| | at(i,j): element access with range checking, const
|
| |
| const T & | atc (std::size_t i, std::size_t j) const |
| | at(i,j): element access with range checking, const ref
|
| |
| T & | operator() (std::size_t i, std::size_t j) |
| | () index access with range checking, mutable
|
| |
| T | operator() (std::size_t i, std::size_t j) const |
| | () index access with range checking, const
|
| |
| auto | begin () |
| | Iterators over flat data buffer.
|
| |
|
auto | end () |
| |
|
auto | cbegin () const |
| |
|
auto | cend () const |
| |