#include <ellalgo/linear_algebra.hpp>
template<typename T>
Matrix2 class
A simple 2D matrix class for linear algebra operations.
| Template parameters | |
|---|---|
| T | The element type (typically float or double) |
This class provides basic matrix operations including matrix-vector multiplication. It is implemented using std::vector of std::vector as the underlying storage.
Constructors, destructors, conversion operators
Public functions
Function documentation
template<typename T>
Matrix2<T>:: Matrix2(size_ t rows,
size_ t cols)
Construct a matrix with specified dimensions.
| Parameters | |
|---|---|
| rows in | The number of rows in the Matrix2 |
| cols in | The number of columns in the Matrix2 |
Creates a matrix with the given number of rows and columns, initializing all elements to the default value of type T.
template<typename T>
std::vector<T>& Matrix2<T>:: operator[](size_ t i)
| Parameters | |
|---|---|
| i | The row index to access. |
| Returns | A reference to the vector of elements at the specified row index. |
Returns a reference to the vector of elements at the specified row index.
template<typename T>
const std::vector<T>& Matrix2<T>:: operator[](size_ t i) const
| Parameters | |
|---|---|
| i | The row index to access. |
| Returns | A constant reference to the vector of elements at the specified row index. |
Returns a constant reference to the vector of elements at the specified row index.