def test_log_after_exp_with_angles_close_to_pi( self, metric, tangent_vec, base_point ): """ Test that the Riemannian left exponential and the Riemannian left logarithm are inverse. Expect their composition to give the identity function. """ group = SpecialEuclidean(3, "vector") result = metric.log(metric.exp(tangent_vec, base_point), base_point) expected = group.regularize_tangent_vec( tangent_vec=tangent_vec, base_point=base_point, metric=metric ) 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_log_after_exp(self, metric, tangent_vec, base_point): """ Test that the Riemannian left exponential and the Riemannian left logarithm are inverse. Expect their composition to give the identity function. """ group = SpecialEuclidean(3, "vector") result = metric.log(metric.exp(tangent_vec, base_point), base_point) expected = group.regularize_tangent_vec( tangent_vec=tangent_vec, base_point=base_point, metric=metric ) norm = gs.linalg.norm(expected) atol = ATOL if norm != 0: atol = ATOL * norm self.assertAllClose(result, expected, atol=atol)