def test_group_log_and_exp(self): point_1 = 5 * gs.eye(4) group_log_1 = spd_matrices_space.group_log(point_1) result_1 = spd_matrices_space.group_exp(group_log_1) expected_1 = point_1 self.assertTrue(gs.allclose(result_1, expected_1))
def test_group_log_and_exp_vectorization(self): n_samples = self.n_samples point = self.space.random_uniform(n_samples) group_log = spd_matrices_space.group_log(point) result = spd_matrices_space.group_exp(group_log) expected = point self.assertTrue(gs.allclose(result, expected))
def log_euclidean(hat_l1, hat_l2): return np.linalg.norm( spd_space.group_log(hat_l1).squeeze(0) - spd_space.group_log(hat_l2).squeeze(0), 'fro')
def riemannian(inv_l1, hat_l2): return np.linalg.norm( inv_l1.dot(spd_space.group_log(hat_l2).squeeze(0).dot(inv_l1)), 'fro')
def frobenius(hat_l1, hat_l2): return np.linalg.norm( spd_space.group_log(hat_l1).squeeze(0) - spd_space.group_log(hat_l2).squeeze(0), 'fro')