|
akreon-linalg
Fixed-size linear algebra and numerical methods in C++26.
|
Owning, fixed-size, row-major matrix container over a scalar field. More...
#include <matrix.hpp>
Public Member Functions | |
| constexpr | Matrix ()=default |
| Construct a value-initialized matrix. | |
| template<typename... RowVectors> requires (sizeof...(RowVectors) == Rows && Rows > 0 && (std::same_as<remove_cvref_t<RowVectors>, Vector<T, Cols>> && ...)) | |
| constexpr | Matrix (RowVectors &&... rows) |
| Construct by copying one fixed-size vector per matrix row. | |
| constexpr const T & | operator() (std::size_t row, std::size_t col) const |
| Read an element at a zero-based row and column. | |
| constexpr T & | operator() (std::size_t row, std::size_t col) |
| Read or modify an element at a zero-based row and column. | |
| constexpr auto | row (std::size_t index) const |
| Copy one matrix row into a fixed-size vector. | |
| constexpr auto | begin () |
| Iterator to the first element in flattened row-major order. | |
| constexpr auto | begin () const |
| Const iterator to the first element in row-major order. | |
| constexpr auto | end () |
| Iterator one past the final flattened element. | |
| constexpr auto | end () const |
| Const iterator one past the final flattened element. | |
| constexpr auto | view () |
| Mutable, fixed-extent view of contiguous row-major storage. | |
| constexpr auto | view () const |
| Const, fixed-extent view of contiguous row-major storage. | |
| constexpr auto | size () const |
Number of stored scalar elements (Rows * Cols). | |
| constexpr bool | operator== (const Matrix &) const =default |
| Compare shape-compatible matrices element by element. | |
Owning, fixed-size, row-major matrix container over a scalar field.
Matrix stores exactly Rows * Cols elements inline. Its dimensions are part of the type, so construction, indexing, iteration, and conversion can all be used during constant evaluation. Default construction value-initializes the backing storage; arithmetic field elements therefore begin at zero.
This type supplies storage and shape, not a coordinate-space policy or a specialized matrix category. Algebraic operations are defined separately, while types such as symmetric matrices and their coordinate maps layer additional meaning over a matrix representation.
Elements use two-dimensional indexing: matrix(row, col). Both indices are zero-based and checked with AK_ASSERT. Iteration and view() expose the flattened row-major order [A(0,0), ..., A(0,Cols-1), A(1,0), ...].
| T | Real or complex field element type. |
| Rows | Compile-time row count. |
| Cols | Compile-time column count. |
Definition at line 44 of file matrix.hpp.
|
constexprdefault |
Construct a value-initialized matrix.
|
inlineexplicitconstexpr |
Construct by copying one fixed-size vector per matrix row.
The number of arguments must equal Rows, and every argument must be a Vector<T, Cols> after cv/ref normalization. This constructor also supports class template argument deduction through the guide below.
| rows | Row vectors in increasing row-index order. |
Definition at line 60 of file matrix.hpp.
References linalg::mat_rows_v, and linalg::Matrix< T, Rows, Cols >::row().
|
inlineconstexpr |
Iterator to the first element in flattened row-major order.
Definition at line 105 of file matrix.hpp.
|
inlineconstexpr |
Const iterator to the first element in row-major order.
Definition at line 107 of file matrix.hpp.
|
inlineconstexpr |
Iterator one past the final flattened element.
Definition at line 109 of file matrix.hpp.
|
inlineconstexpr |
Const iterator one past the final flattened element.
Definition at line 111 of file matrix.hpp.
|
inlineconstexpr |
Read or modify an element at a zero-based row and column.
Definition at line 84 of file matrix.hpp.
References AK_ASSERT, linalg::mat_rows_v, and linalg::Matrix< T, Rows, Cols >::row().
|
inlineconstexpr |
Read an element at a zero-based row and column.
Definition at line 74 of file matrix.hpp.
References AK_ASSERT, linalg::mat_rows_v, and linalg::Matrix< T, Rows, Cols >::row().
|
constexprdefault |
Compare shape-compatible matrices element by element.
|
inlineconstexpr |
Copy one matrix row into a fixed-size vector.
Returning a value deliberately keeps Matrix storage encapsulated. Use view() when direct access to the contiguous flattened storage is needed.
Definition at line 96 of file matrix.hpp.
References AK_ASSERT, and linalg::mat_rows_v.
Referenced by linalg::Matrix< T, Rows, Cols >::Matrix(), linalg::Matrix< T, Rows, Cols >::operator()(), and linalg::Matrix< T, Rows, Cols >::operator()().
|
inlineconstexpr |
Number of stored scalar elements (Rows * Cols).
Definition at line 119 of file matrix.hpp.
|
inlineconstexpr |
Mutable, fixed-extent view of contiguous row-major storage.
Definition at line 113 of file matrix.hpp.
|
inlineconstexpr |
Const, fixed-extent view of contiguous row-major storage.
Definition at line 115 of file matrix.hpp.