Skip to content

Commit c1bfa26

Browse files
committed
Improve loop order in matmul
Fixes #306.
1 parent ba85dcd commit c1bfa26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/data-structures/Matrix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ template<class T, int N> struct Matrix {
1818
M operator*(const M& m) const {
1919
M a;
2020
rep(i,0,N) rep(j,0,N)
21-
rep(k,0,N) a.d[i][j] += d[i][k]*m.d[k][j];
21+
rep(k,0,N) a.d[i][k] += d[i][j] * m.d[j][k];
2222
return a;
2323
}
2424
array<T, N> operator*(const array<T, N>& vec) const {

0 commit comments

Comments
 (0)