You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A matrix dot by it's inverse matrix will be a cell matrix.
There are two example of numpy and trueskill.mathematics
>> from trueskill.trueskill.mathematics import Matrix
>> import numpy as np
>> d = [[1, 2, 3], [6, 5, 10], [7, 8, 9]]
>> m = Matrix(d[:])
>> m.inverse() * m
Matrix([[4.2222222222222205, 3.1666666666666656, 4.777777777777777], [-0.6666666666666659, 4.440892098500626e-16, -1.3333333333333321], [0.11111111111111138, -0.16666666666666652, 0.8888888888888893]])
>> m = np.array(d[:])
>> np.linalg.inv(m) @ m
array([[ 1.00000000e+00, 1.11022302e-15, 1.85962357e-15],
[-5.27355937e-16, 1.00000000e+00, -3.60822483e-16],
[-2.22044605e-16, -2.22044605e-16, 1.00000000e+00]])
This reason for this bug is that adjugate matrix is not transposed.
### trueskill\trueskill\mathematics.py
def adjugate(self):
height, width = self.height, self.width
if height != width:
raise ValueError('Only square matrix can be adjugated')
if height == 2:
a, b = self[0][0], self[0][1]
c, d = self[1][0], self[1][1]
return type(self)([[d, -b], [-c, a]])
src = {}
for r in range(height):
for c in range(width):
sign = -1 if (r + c) % 2 else 1
src[r, c] = self.minor(r, c).determinant() * sign
--- return type(self)(src, height, width)
+++ return type(self)(src, height, width).transpose()
The text was updated successfully, but these errors were encountered:
mmooyyii
changed the title
bug: matrix.adjuadge return a error value when row and col is greater than 2;
bug: matrix.adjuadge return a error value when row and col are greater than 2;
Aug 15, 2021
A matrix dot by it's inverse matrix will be a cell matrix.
There are two example of numpy and trueskill.mathematics
This reason for this bug is that adjugate matrix is not transposed.
The text was updated successfully, but these errors were encountered: