qualpal::Matrix
C++ · cpp · 4.1.0
Dynamic matrix class with runtime-determined dimensions.
Template parameters
T
Element type (typically double or float).
Stores elements in column-major order (Fortran-style). Provides element access, transposition, and dimension queries.
Example:
Matrix<double> ; // 2 rows, 3 columns
= 5.0; // Set element at row 0, column 1
double v = ; // Get element at row 1, column 2See also
FixedMatrix for compile-time sized matrices
Methods
Matrix
Matrix
Source: include/qualpal/matrix.h
inline Default constructor creates an empty matrix (0x0).
Matrix
Source: include/qualpal/matrix.h
inline Construct matrix with specified dimensions.
Parameters
rows
Number of rows
cols
Number of columns
Matrix
Source: include/qualpal/matrix.h
inline Construct matrix with specified dimensions and data.
Parameters
rows
Number of rows
cols
Number of columns
data
Vector containing matrix elements in column-major order
ncol
Source: include/qualpal/matrix.h
inline std::size_t Get number of columns.
nrow
Source: include/qualpal/matrix.h
inline std::size_t Get number of rows.
operator()
operator()
Source: include/qualpal/matrix.h
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 column-major order: data[col * nrow + row].
Throws
std::out_of_range
if indices are out of bounds (in debug builds).
operator()
Source: include/qualpal/matrix.h
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 column-major order: data[col * nrow + row].
Throws
std::out_of_range
if indices are out of bounds (in debug builds).
transpose
Source: include/qualpal/matrix.h
inline Matrix<T> Create transpose of this matrix.
Returns
New matrix that is the transpose of this matrix
