Initial commit

This commit is contained in:
2026-08-24 19:27:25 +02:00
commit bdda0c3880
7 changed files with 219 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#include "matrix.hpp"
#include <array>
Matrix::Matrix(int rows, int cols) : data(rows*cols, 0.0), rows(rows), cols(cols) {}
std::array<int, 2> Matrix::size() const {return {rows, cols};}
double& Matrix::operator()(int i, int j) {return data[i*cols+j];}
double Matrix::operator()(int i, int j) const {return data[i*cols+j];}
void Matrix::print() const {
std::cout << "---\n";
for (int x=0; x<rows; x++) {
for (int y=0; y<cols; y++) {
std::cout << data[x*cols+y] << " ";
}
std::cout << "\n";
}
std::cout << "---";
std::cout << std::endl;
}