def test_generate_rotation_rotor_and_angle(self): """ Checks rotation rotor generation """ from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors for i in range(1000): euc_vector_m = random_unit_vector() euc_vector_n = random_unit_vector() theta = angle_between_vectors(euc_vector_m, euc_vector_n) rot_rotor = generate_rotation_rotor(theta, euc_vector_m, euc_vector_n) v1 = euc_vector_m v2 = rot_rotor*euc_vector_m*~rot_rotor theta_return = angle_between_vectors(v1, v2) testing.assert_almost_equal(theta_return, theta) testing.assert_almost_equal(euc_vector_n.value, v2.value)
def test_generate_rotation_rotor_and_angle(self, rng): # noqa: F811 """ Checks rotation rotor generation """ from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors for i in range(1000): euc_vector_m = random_unit_vector(rng=rng) euc_vector_n = random_unit_vector(rng=rng) theta = angle_between_vectors(euc_vector_m, euc_vector_n) rot_rotor = generate_rotation_rotor(theta, euc_vector_m, euc_vector_n) v1 = euc_vector_m v2 = rot_rotor * euc_vector_m * ~rot_rotor theta_return = angle_between_vectors(v1, v2) testing.assert_almost_equal(theta_return, theta) testing.assert_almost_equal(euc_vector_n.value, v2.value)
def test_generate_rotation_rotor_and_angle(self): """ Checks rotation rotor generation """ from clifford.tools.g3 import generate_rotation_rotor, random_unit_vector, angle_between_vectors euc_vector_m = random_unit_vector() euc_vector_n = random_unit_vector() theta = angle_between_vectors(euc_vector_m, euc_vector_n) print(theta) rot_rotor = generate_rotation_rotor(theta, euc_vector_m, euc_vector_n) v1 = euc_vector_m v2 = rot_rotor * euc_vector_m * ~rot_rotor theta_return = angle_between_vectors(v1, v2) print(theta_return) testing.assert_almost_equal(theta_return, theta) testing.assert_almost_equal(euc_vector_n.value, v2.value)