Compare commits
2 Commits
13900179a1
...
d745515695
| Author | SHA1 | Date | |
|---|---|---|---|
| d745515695 | |||
| 5b60de1f17 |
7
matrix.c
7
matrix.c
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user