def test_exp_and_log_from_identity_left_diag_metrics(self): """ Test that the riemannian exponential and the riemannian logarithm are inverse. Expect their composition to give the identity function. """ # - exp then log # For left diagonal metric, point and point_small result = helper.exp_then_log_from_identity( metric=self.left_diag_metric, tangent_vec=self.point_1) expected = self.point_1 self.assertAllClose(result, expected) result = helper.exp_then_log_from_identity( metric=self.left_diag_metric, tangent_vec=self.point_small) expected = self.point_small self.assertAllClose(result, expected) # - log then exp # For left diagonal metric, point and point_small result = helper.log_then_exp_from_identity( metric=self.left_diag_metric, point=self.point_1) expected = self.point_1 self.assertAllClose(result, expected) result = helper.log_then_exp_from_identity( metric=self.left_diag_metric, point=self.point_small) expected = self.point_small self.assertAllClose(result, expected)
def test_exp_and_log_from_identity_right_metrics(self): """ Test that the riemannian exponential and the riemannian logarithm are inverse. Expect their composition to give the identity function. """ # For right metric, point and point_small result = helper.exp_then_log_from_identity(self.right_metric, self.point_1) expected = self.point_1 # self.assertAllClose(result, expected) result = helper.exp_then_log_from_identity(self.right_metric, self.point_small) expected = self.point_small # self.assertAllClose(result, expected) # - log then exp # For right metric, point and point_small result = helper.log_then_exp_from_identity(self.right_metric, self.point_1) expected = self.point_1 # self.assertAllClose(result, expected) result = helper.log_then_exp_from_identity(self.right_metric, self.point_small) expected = self.point_small
def test_exp_and_log_from_identity_left_metrics(self): """ Test that the riemannian exponential and the riemannian logarithm are inverse. Expect their composition to give the identity function. """ # - exp then log # For left metric, point and point_small result = helper.exp_then_log_from_identity(metric=self.left_metric, tangent_vec=self.point_1) expected = self.point_1 expected = helper.to_vector(expected) with self.test_session(): self.assertAllClose(gs.eval(result), gs.eval(expected)) result = helper.exp_then_log_from_identity( metric=self.left_metric, tangent_vec=self.point_small) expected = self.point_small expected = helper.to_vector(expected) with self.test_session(): self.assertAllClose(gs.eval(result), gs.eval(expected)) # - log then exp # For left metric, point and point_small result = helper.log_then_exp_from_identity(metric=self.left_metric, point=self.point_1) expected = self.point_1 expected = helper.to_vector(expected) with self.test_session(): self.assertAllClose(gs.eval(result), gs.eval(expected)) result = helper.log_then_exp_from_identity(metric=self.left_metric, point=self.point_small) expected = self.point_small expected = helper.to_vector(expected) with self.test_session(): self.assertAllClose(gs.eval(result), gs.eval(expected))