rename data to mem

This commit is contained in:
Max Lübke 2023-10-02 13:08:41 +02:00
parent 4f92c2a976
commit 8bc248c8e5

View File

@ -12,11 +12,11 @@
template <class T> struct Matrix { template <class T> struct Matrix {
std::uint32_t rows; std::uint32_t rows;
std::uint32_t cols; std::uint32_t cols;
std::vector<T> data; std::vector<T> mem;
Matrix<T>(std::uint32_t _rows, std::uint32_t _cols) Matrix<T>(std::uint32_t _rows, std::uint32_t _cols)
: rows(_rows), cols(_cols) { : rows(_rows), cols(_cols) {
data.resize(rows * cols); mem.resize(rows * cols);
} }
Matrix<T>(const char *filepath) { Matrix<T>(const char *filepath) {
@ -39,17 +39,17 @@ template <class T> struct Matrix {
} }
T &operator()(std::uint32_t row_i, std::uint32_t col_j) { T &operator()(std::uint32_t row_i, std::uint32_t col_j) {
return data[row_i * cols + col_j]; return mem[row_i * cols + col_j];
} }
const T &operator()(std::uint32_t row_i, std::uint32_t col_j) const { const T &operator()(std::uint32_t row_i, std::uint32_t col_j) const {
return data[row_i * cols + col_j]; return mem[row_i * cols + col_j];
} }
Matrix<T> &operator=(const Matrix<T> &mat) { Matrix<T> &operator=(const Matrix<T> &mat) {
this->rows = mat.rows; this->rows = mat.rows;
this->cols = mat.cols; this->cols = mat.cols;
this->data = data; this->data = mem;
return *this; return *this;
} }
@ -66,7 +66,7 @@ template <class T> struct Matrix {
XXH32_hash_t chksum() const { XXH32_hash_t chksum() const {
constexpr XXH32_hash_t HASH_SEED = 42; constexpr XXH32_hash_t HASH_SEED = 42;
return XXH32(this->data.data(), data.size(), HASH_SEED); return XXH32(this->data.data(), mem.size(), HASH_SEED);
} }
}; };