Mercurial > touhou
diff pytouhou/utils/matrix.pyx @ 411:2428296cccab
Remove indirect access to Matrix values.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 12 Jun 2013 16:07:22 +0200 |
parents | 74471afbac37 |
children | 5fe6cd6ceb48 |
line wrap: on
line diff
--- a/pytouhou/utils/matrix.pyx +++ b/pytouhou/utils/matrix.pyx @@ -24,15 +24,14 @@ cdef class Matrix: [0, 0, 0, 1]] - def __getitem__(Matrix self, key): - return self.data[key] - - def __mul__(Matrix self, Matrix other): out = Matrix() + d1 = self.data + d2 = other.data + d3 = out.data for i in xrange(4): for j in xrange(4): - out[i][j] = sum(self[i][k] * other[k][j] for k in xrange(4)) + d3[i][j] = sum(d1[i][k] * d2[k][j] for k in xrange(4)) return out