so finde ich es schöner...
This commit is contained in:
parent
e7930c7eb0
commit
21d9b5c01d
5
matrix.c
5
matrix.c
@ -174,10 +174,11 @@ Matrix multiply(const Matrix matrix1, const Matrix matrix2) {
|
|||||||
MatrixType sum = 0.0;
|
MatrixType sum = 0.0;
|
||||||
//skalarprodukte berechnen, k damit die ganze zeile mal die ganze spalte genommen wird quasi
|
//skalarprodukte berechnen, k damit die ganze zeile mal die ganze spalte genommen wird quasi
|
||||||
for (int k=0; k< matrix1.cols; k++){
|
for (int k=0; k< matrix1.cols; k++){
|
||||||
sum+= matrix1.buffer[r*matrix1.cols+k]*matrix2.buffer[k*matrix2.cols+c];
|
//sum+= matrix1.buffer[r*matrix1.cols+k]*matrix2.buffer[k*matrix2.cols+c];
|
||||||
|
sum += getMatrixAt(matrix1, r, k)*getMatrixAt(matrix2, k, c);
|
||||||
}
|
}
|
||||||
//Ergebnisse in neue matrix speichern
|
//Ergebnisse in neue matrix speichern
|
||||||
multMatrix.buffer[r*multMatrix.cols+c] = sum;
|
setMatrixAt(sum, multMatrix, r, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return multMatrix;
|
return multMatrix;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user