def test_exp_after_log(self, metric, point, base_point): """ Test that the Riemannian right exponential and the Riemannian right logarithm are inverse. Expect their composition to give the identity function. """ group = SpecialEuclidean(3, "vector") result = metric.exp(metric.log(point, base_point), base_point) expected = group.regularize(point) expected = gs.cast(expected, gs.float64) norm = gs.linalg.norm(expected) atol = ATOL if norm != 0: atol = ATOL * norm self.assertAllClose(result, expected, atol=atol)
def test_exp_after_log_right_with_angles_close_to_pi( self, metric, point, base_point): group = SpecialEuclidean(3, "vector") result = metric.exp(metric.log(point, base_point), base_point) expected = group.regularize(point) inv_expected = gs.concatenate([-expected[:3], expected[3:6]]) norm = gs.linalg.norm(expected) atol = ATOL if norm != 0: atol = ATOL * norm self.assertTrue( gs.allclose(result, expected, atol=atol) or gs.allclose(result, inv_expected, atol=atol))
def test_regularize_extreme_cases(self, point, expected): group = SpecialEuclidean(3, "vector") result = group.regularize(point) self.assertAllClose(result, expected)