Skip to content

Commit

Permalink
FIX: fix determinant of random rotation matrix
Browse files Browse the repository at this point in the history
determinant sign was wrong if dimensions of rotation
matrix were odd. Thanks to Philip DeBoer.
Actual Fix.
  • Loading branch information
otizonaizit committed Mar 6, 2012
1 parent 1ede6ab commit c7a7a9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mdp/utils/routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def random_rot(dim, dtype='d'):
mat[n-1:, n-1:] = Hx
H = mdp.utils.mult(H, mat)
# Fix the last sign such that the determinant is 1
D[-1] = -D.prod()
D[-1] = (-1)**(1-dim%2)*D.prod()
# Equivalent to mult(numx.diag(D), H) but faster
H = (D*H.T).T
return H
Expand Down

0 comments on commit c7a7a9e

Please sign in to comment.