fix multiplyAny
This commit is contained in:
parent
dfa16befec
commit
c77359146f
|
@ -130,7 +130,7 @@ void multiplyAny(GLfloat* out, GLfloat* A, GLfloat* B, int wA, int hA, int wB) {
|
|||
for (int i = 0; i < sizeOut; i++) {
|
||||
result[i] = 0;
|
||||
for (int j = 0; j < wA; j++) {
|
||||
result[i] += A[j * hA + i % hA] * B[j + i / hA * wB];
|
||||
result[i] += A[j * hA + i % hA] * B[j + i / hA * wA];
|
||||
}
|
||||
}
|
||||
memcpy(out, result, sizeOut * sizeof(GLfloat));
|
||||
|
|
|
@ -401,10 +401,10 @@ void testMultiplyAny() {
|
|||
GLfloat result[4] = {0, 0,
|
||||
0, 0}; // 2x2 result matrix
|
||||
|
||||
GLfloat expectedResult[4] = {39, 54,
|
||||
69, 49};
|
||||
GLfloat expectedResult[4] = {76, 100,
|
||||
103, 136};
|
||||
|
||||
multiplyAny(&result, &matrix1, &matrix2, 2, 3, 2);
|
||||
multiplyAny(&result, &matrix1, &matrix2, 3, 2, 2);
|
||||
|
||||
printTest("Multiply Any", sumDiffAny(result, expectedResult, 2, 2) < EPSILON);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue