Compare commits
No commits in common. "d74551569582ff82518841c81ca86fe80ab2e807" and "13900179a11a67e7701ced253f9d4cfa8b5c08f1" have entirely different histories.
d745515695
...
13900179a1
7
matrix.c
7
matrix.c
@ -98,19 +98,26 @@ 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user