HighMap library (C++)
|
Mat class for basic manipulation of 2D matrices. More...
#include <algebra.hpp>
Public Member Functions | |
Mat (Vec2< int > shape) | |
Constructor to initialize a matrix with a given shape. | |
T & | operator() (int i, int j) |
Access operator to get a reference to the element at (i, j). | |
const T & | operator() (int i, int j) const |
Const access operator to get the value of the element at (i, j). | |
Public Attributes | |
std::vector< T > | vector |
1D vector storing matrix elements in row-major order. | |
Vec2< int > | shape |
Dimensions of the matrix (rows x columns). | |
Mat class for basic manipulation of 2D matrices.
This class provides basic operations for 2D matrices, such as element access and initialization. It stores the matrix elements in a 1D vector and provides a convenient interface for accessing elements using 2D indices.
T | Data type for the matrix elements (e.g., int, float, double). |
Constructor to initialize a matrix with a given shape.
Allocates memory for the matrix elements based on the specified shape. The matrix is initialized with the default value of the type T.
shape | A Vec2<int> representing the number of rows and columns in the matrix. |
|
inline |
Access operator to get a reference to the element at (i, j).
Provides non-const access to the matrix element at the specified row and column.
i | Row index (0-based). |
j | Column index (0-based). |
|
inline |
Const access operator to get the value of the element at (i, j).
Provides const access to the matrix element at the specified row and column.
i | Row index (0-based). |
j | Column index (0-based). |
std::vector<T> hmap::Mat< T >::vector |
1D vector storing matrix elements in row-major order.