|
NumericAL
A header-only C++20 lexer built on REAL
|
A dense, row-major matrix of T with value semantics.
More...
#include <matrix.hpp>
Public Member Functions | |
| matrix ()=default | |
| An empty matrix (0×0). | |
| matrix (std::initializer_list< std::initializer_list< T > > rows) | |
| From a braced list of rows; every row must have the same length. | |
| matrix (std::size_t rows, std::size_t cols, buffer< T > elements) | |
| From dimensions and a flat row-major buffer. | |
| matrix (std::size_t rows, std::size_t cols, const std::vector< T > &elements) | |
| From dimensions and a flat row-major std::vector, copied into the storage (a buffer moves in instead). | |
| matrix (std::size_t rows, std::size_t cols, std::initializer_list< T > elements) | |
| From dimensions and a braced list of the elements, row-major. | |
| std::size_t | rows () const noexcept |
| The number of rows. | |
| std::size_t | cols () const noexcept |
| The number of columns. | |
| const T & | operator() (std::size_t row, std::size_t col) const |
The element at (row, col). | |
| bool | operator== (const matrix &other) const |
| Exact equality (same shape and equal elements). | |
| buffer< T >::const_iterator | begin () const noexcept |
| Const iterator to the first element (row-major). | |
| buffer< T >::const_iterator | end () const noexcept |
| Const iterator past the last element. | |
| buffer< T > | elements () && |
The elements, row-major, handed over by a matrix about to expire, which is left 0 × 0: a large result moves on without a copy (each copy of a fresh buffer faults its pages in one by one). | |
Private Attributes | |
| std::size_t | rows_ {0} |
| The number of rows. | |
| std::size_t | cols_ {0} |
| The number of columns. | |
| buffer< T > | data_ |
| The elements, row-major. | |
A dense, row-major matrix of T with value semantics.
| T | The scalar element type. |
Definition at line 34 of file matrix.hpp.
|
default |
An empty matrix (0×0).
|
inline |
From a braced list of rows; every row must have the same length.
| [in] | rows | The rows, each a braced list of elements. |
| dimension_error | If the rows have unequal lengths. |
Definition at line 46 of file matrix.hpp.
|
inlineexplicit |
From dimensions and a flat row-major buffer.
| [in] | rows,cols | The dimensions. |
| [in] | elements | The rows*cols elements, row-major (moved in). |
| dimension_error | If elements.size() is not rows*cols. |
Definition at line 68 of file matrix.hpp.
|
inlineexplicit |
From dimensions and a flat row-major std::vector, copied into the storage (a buffer moves in instead).
| [in] | rows,cols | The dimensions. |
| [in] | elements | The rows*cols elements, row-major. |
| dimension_error | If elements.size() is not rows*cols. |
Definition at line 84 of file matrix.hpp.
|
inlineexplicit |
From dimensions and a braced list of the elements, row-major.
| [in] | rows,cols | The dimensions. |
| [in] | elements | The rows*cols elements, row-major. |
| dimension_error | If the list's length is not rows*cols. |
Definition at line 98 of file matrix.hpp.
|
inlinenoexcept |
Const iterator to the first element (row-major).
Definition at line 132 of file matrix.hpp.
|
inlinenoexcept |
The number of columns.
Definition at line 113 of file matrix.hpp.
The elements, row-major, handed over by a matrix about to expire, which is left 0 × 0: a large result moves on without a copy (each copy of a fresh buffer faults its pages in one by one).
Definition at line 145 of file matrix.hpp.
|
inlinenoexcept |
Const iterator past the last element.
Definition at line 138 of file matrix.hpp.
|
inline |
|
inline |
Exact equality (same shape and equal elements).
Definition at line 126 of file matrix.hpp.
|
inlinenoexcept |
The number of rows.
Definition at line 107 of file matrix.hpp.
|
private |
The number of columns.
Definition at line 155 of file matrix.hpp.
The elements, row-major.
Definition at line 156 of file matrix.hpp.
|
private |
The number of rows.
Definition at line 154 of file matrix.hpp.