Complete refactor

This commit is contained in:
2025-10-29 14:43:30 +04:00
parent 2955fbbe42
commit 187492c6b0
19 changed files with 631 additions and 470 deletions

View File

@@ -0,0 +1,24 @@
#include "matrix.hpp"
Matrices::CPU::CPU(int rows, int cols, float value)
: IMatrix(rows, cols), data(rows * cols, value) {
validateDimensions(rows, cols);
}
Matrices::CPU::CPU(int rows, int cols, const std::vector<float> &matrix)
: IMatrix(rows, cols), data(matrix) {
validateDimensions(rows, cols);
if (matrix.size() != static_cast<size_t>(rows * cols)) {
throw std::invalid_argument("Data size doesn't match matrix dimensions");
}
}
float &Matrices::CPU::operator()(int row, int col) {
checkIndices(row, col);
return data[row * cols + col];
}
const float &Matrices::CPU::operator()(int row, int col) const {
checkIndices(row, col);
return data[row * cols + col];
}