Compare commits

...

2 Commits

Author SHA1 Message Date
d745515695 matrix mult funktioniert 2025-11-15 15:07:42 +01:00
5b60de1f17 Revert "kurzer zwischenspeicher"
This reverts commit 13900179a11a67e7701ced253f9d4cfa8b5c08f1.
2025-11-15 15:05:23 +01:00

View File

@ -98,26 +98,19 @@ Matrix multiply(const Matrix matrix1, const Matrix matrix2)
else else
{ {
Matrix result = createMatrix(matrix1.rows, matrix2.cols); Matrix result = createMatrix(matrix1.rows, matrix2.cols);
for (unsigned int i = 0; i < result.rows; i++) for (unsigned int i = 0; i < result.rows; i++)
{ {
for (unsigned int j = 0; j < result.cols; j++) for (unsigned int j = 0; j < result.cols; j++)
{ {
MatrixType summe = 0; MatrixType summe = 0;
for (unsigned int k = 0; k < matrix1.cols; k++) for (unsigned int k = 0; k < matrix1.cols; k++)
{ {
summe += getMatrixAt(matrix1, i, k) * getMatrixAt(matrix2, k, j); summe += getMatrixAt(matrix1, i, k) * getMatrixAt(matrix2, k, j);
} }
setMatrixAt(summe, result, i, j); setMatrixAt(summe, result, i, j);
} }
} }
return result; return result;
} }