Ejemplo n.º 1
0
    def test_exp_and_log_right_metrics(self):
        """
        Test that the Riemannian exponential and the
        Riemannian logarithm are inverse.
        Expect their composition to give the identity function.
        """
        # General case for the reference point
        base_point = self.point_2
        # For right metric: point and point_small
        result = helper.log_then_exp(self.right_metric, self.point_1, base_point)
        expected = self.point_1
        self.assertAllClose(result, expected, atol=1e-4)

        result = helper.log_then_exp(self.right_metric, self.point_small, base_point)
        expected = self.point_small
        self.assertAllClose(result, expected)
Ejemplo n.º 2
0
    def test_exp_and_log_right_diag_metrics(self):
        """
        Test that the riemannian exponential and the
        riemannian logarithm are inverse.
        Expect their composition to give the identity function.
        """
        # General case for the reference point
        base_point = self.point_2
        # For right diagonal metric: point and point_small
        result = helper.log_then_exp(self.right_diag_metric,
                                     base_point, self.point_1)
        expected = self.group.regularize(self.point_1)
        # self.assertAllClose(result, expected)

        result = helper.log_then_exp(self.right_diag_metric,
                                     base_point, self.point_small)
        expected = self.group.regularize(self.point_small)
Ejemplo n.º 3
0
    def test_exp_and_log_left_metrics(self):
        """
        Test that the riemannian exponential and the
        riemannian logarithm are inverse.
        Expect their composition to give the identity function.
        """
        # General case for the reference point
        base_point = self.point_2

        # For left metric: point and point_small
        result = helper.log_then_exp(self.left_metric, base_point,
                                     self.point_1)
        expected = self.point_1
        # self.assertTrue(gs.allclose(result, expected))

        result = helper.log_then_exp(self.left_metric, base_point,
                                     self.point_small)
        expected = self.point_small
Ejemplo n.º 4
0
    def test_exp_and_log_right_diag_metrics(self):
        """
        Test that the Riemannian exponential and the
        Riemannian logarithm are inverse.
        Expect their composition to give the identity function.
        """
        # FIXME: lower numerical accuracy with tensorflow
        # General case for the reference point
        base_point = self.point_2
        # For right diagonal metric: point and point_small
        result = helper.log_then_exp(
            self.right_diag_metric, self.point_1, base_point)
        expected = self.group.regularize(self.point_1)
        self.assertAllClose(result, expected, atol=1e-4, rtol=1e-4)

        result = helper.log_then_exp(
            self.right_diag_metric, self.point_small, base_point)
        expected = self.group.regularize(self.point_small)
        self.assertAllClose(result, expected, atol=1e-4, rtol=1e-4)
Ejemplo n.º 5
0
    def test_exp_and_log_left_diag_metrics(self):
        """
        Test that the riemannian exponential and the
        riemannian logarithm are inverse.
        Expect their composition to give the identity function.
        """
        # General case for the reference point
        base_point = self.point_2

        # General point
        result = helper.log_then_exp(self.left_diag_metric, base_point,
                                     self.point_1)
        expected = self.group.regularize(self.point_1)
        # self.assertTrue(gs.allclose(result, expected))

        # Edge case, small angle
        result = helper.log_then_exp(self.left_diag_metric, base_point,
                                     self.point_small)
        expected = self.group.regularize(self.point_small)