Beispiel #1
0
 def test_log_and_exp_power_affine(self):
     base_point = gs.array([[5., 0., 0.], [0., 7., 2.], [0., 2., 8.]])
     point = gs.array([[9., 0., 0.], [0., 5., 0.], [0., 0., 1.]])
     metric = SPDMetricAffine(3, power_affine=.5)
     log = metric.log(point, base_point)
     result = metric.exp(log, base_point)
     expected = point
     self.assertAllClose(result, expected)
Beispiel #2
0
 def test_estimate_spd_two_samples(self):
     space = SPDMatrices(3)
     metric = SPDMetricAffine(3)
     point = space.random_point(2)
     mean = FrechetMean(metric)
     mean.fit(point)
     result = mean.estimate_
     expected = metric.exp(metric.log(point[0], point[1]) / 2, point[1])
     self.assertAllClose(expected, result)
Beispiel #3
0
 def test_log_and_exp_power_affine(self):
     """Test of SPDMetricAffine.log and exp methods with power!=1."""
     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 = SPDMetricAffine(3, power_affine=0.5)
     log = metric.log(point, base_point)
     result = metric.exp(log, base_point)
     expected = point
     self.assertAllClose(result, expected)
 def test_exp(self, n, power_affine, tangent_vec, base_point, expected):
     metric = SPDMetricAffine(n, power_affine)
     self.assertAllClose(
         metric.exp(gs.array(tangent_vec), gs.array(base_point)), gs.array(expected)
     )