def test_rotation_matrix_conversions(self): """ Bidirectional rotor - rotation matrix test. This needs work but is a reasonable start """ from clifford.g3c import layout, up, down from clifford.tools.g3 import rotation_matrix_to_rotor, rotor_to_rotation_matrix from clifford.tools.g3c import random_rotation_rotor, random_conformal_point, apply_rotor for i in range(1000): rotor = random_rotation_rotor() # Check that we can map up and back Rmat = rotor_to_rotation_matrix(rotor) rotor_return = rotation_matrix_to_rotor(Rmat) testing.assert_almost_equal(rotor.value, rotor_return.value) # Check that the rotations do the same thing A = random_conformal_point() B = down(apply_rotor(A, rotor)).value[1:4] C = Rmat @ down(A).value[1:4] np.testing.assert_almost_equal(B, C)