コード例 #1
0
    def test_log_and_exp_euclidean_p05(self):
        """Test of SPDMetricEuclidean.log and exp methods for power_euclidean=0.5."""
        base_point = gs.array([[5.0, 0.0, 0.0], [0.0, 7.0, 2.0], [0.0, 2.0, 8.0]])
        point = gs.array([[9.0, 0.0, 0.0], [0.0, 5.0, 0.0], [0.0, 0.0, 1.0]])

        metric = SPDMetricEuclidean(3, power_euclidean=0.5)
        log = metric.log(point=point, base_point=base_point)
        result = metric.exp(tangent_vec=log, base_point=base_point)
        expected = point

        self.assertAllClose(result, expected)
コード例 #2
0
 def test_log_then_exp(self, n, power_euclidean, point, base_point):
     metric = SPDMetricEuclidean(n, power_euclidean)
     log = metric.log(gs.array(point), base_point=gs.array(base_point))
     result = metric.exp(tangent_vec=log, base_point=gs.array(base_point))
     self.assertAllClose(result, point, atol=gs.atol * 1000)
コード例 #3
0
 def test_log(self, n, power_euclidean, point, base_point, expected):
     metric = SPDMetricEuclidean(n)
     result = metric.log(gs.array(point), gs.array(base_point))
     self.assertAllClose(result, gs.array(expected))