qualpal::FixedMatrix
C++ · cpp · 4.1.0
Fixed-size matrix class with compile-time dimensions.
Template parameters
T
Element type (typically double or float).
rows
Number of rows (compile-time constant).
cols
Number of columns (compile-time constant).
Stores elements in row-major order (C-style). Provides constexpr element access, arithmetic, and multiplication.
Example:
FixedMatrix<double, 2, 3> mat = ;
double v = ; // Access element at row 1, column 2See also
Matrix for dynamic-sized matrices
Methods
FixedMatrix
FixedMatrix
Source: include/qualpal/matrix.h
constexpr inline constexpr Default constructor - elements are zero-initialized.
FixedMatrix
Source: include/qualpal/matrix.h
constexpr inline constexpr Construct from nested initializer list.
Parameters
list
Nested initializer list of matrix elements
fill
Source: include/qualpal/matrix.h
constexpr inline void Fill all elements with specified value.
operator()
operator()
Source: include/qualpal/matrix.h
constexpr inline T & Access matrix element (mutable).
Parameters
row
Row index (0-based).
col
Column index (0-based).
Returns
Reference to element at (row, col).
Note
Elements are stored in row-major order: data[row * cols + col].
Throws
std::out_of_range
if indices are out of bounds (in debug builds).
operator()
Source: include/qualpal/matrix.h
constexpr inline const T & Access matrix element (const).
Parameters
row
Row index (0-based).
col
Column index (0-based).
Returns
Const reference to element at (row, col).
Note
Elements are stored in row-major order: data[row * cols + col].
Throws
std::out_of_range
if indices are out of bounds (in debug builds).
operator*
operator*
Source: include/qualpal/matrix.h
constexpr inline Matrix<T> Matrix-matrix multiplication (FixedMatrix * dynamic Matrix).
Parameters
other
Dynamic matrix to multiply with
Returns
Result as dynamic Matrix
operator*
Source: include/qualpal/matrix.h
constexpr inline FixedMatrix<T, rows, cols> Scalar multiplication.
Parameters
scalar
Value to multiply all elements by
Returns
New matrix with all elements multiplied by scalar
operator*
Source: include/qualpal/matrix.h
constexpr inline std::array<T, rows> Matrix-vector multiplication.
Parameters
vec
Vector to multiply with (must have 'cols' elements)
Returns
Result vector with 'rows' elements
operator*
Source: include/qualpal/matrix.h
constexpr inline FixedMatrix<T, rows, other_cols> Matrix-matrix multiplication (FixedMatrix * FixedMatrix).
Template parameters
other_cols
Number of columns in the other matrix.
Parameters
other
The matrix to multiply with (must have 'cols' rows).
Returns
Result matrix with dimensions (rows × other_cols).
operator+
Source: include/qualpal/matrix.h
constexpr inline FixedMatrix<T, rows, cols> Matrix addition.
Parameters
other
Matrix to add (must have same dimensions)
Returns
New matrix containing element-wise sum
operator-
Source: include/qualpal/matrix.h
constexpr inline FixedMatrix<T, rows, cols> Matrix subtraction.
Parameters
other
Matrix to subtract (must have same dimensions)
Returns
New matrix containing element-wise difference
t
Source: include/qualpal/matrix.h
constexpr inline FixedMatrix<T, cols, rows> Create transpose of this matrix.
Returns
New FixedMatrix that is the transpose of this matrix
zeros
Source: include/qualpal/matrix.h
constexpr inline void Set all elements to zero.
