def test_group_exp_then_log(self):
        """
        This tests that the composition of
        log and exp gives identity.

        """
        base_point = gs.array([0.12])
        tangent_vec = gs.array([0.35])

        result = helper.group_exp_then_log(group=self.group,
                                           tangent_vec=tangent_vec,
                                           base_point=base_point)

        expected = self.group.regularize_tangent_vec(tangent_vec=tangent_vec,
                                                     base_point=base_point)

        self.assertAllClose(result, expected)
Beispiel #2
0
    def test_group_exp_then_log(self):
        """
        Test that the group exponential
        and the group logarithm are inverse.
        Expect their composition to give the identity function.
        """
        for base_point_type in self.elements:
            base_point = self.elements[base_point_type]
            for element_type in self.elements:
                tangent_vec = self.elements[element_type]
                result = helper.group_exp_then_log(group=self.group,
                                                   tangent_vec=tangent_vec,
                                                   base_point=base_point)
                expected = self.group.regularize_tangent_vec(
                    tangent_vec=tangent_vec, base_point=base_point)
                self.assertAllClose(result, expected, rtol=1e-4)

                if geomstats.tests.tf_backend():
                    break