def test_geodesic_with_log_connection(self, dim, point, end_point, n_times, n_steps, expected, atol): sphere = Hypersphere(dim) connection = Connection(dim) connection.christoffels = sphere.metric.christoffels geo = connection.geodesic(initial_point=point, end_point=end_point, n_steps=n_steps) times = gs.linspace(0, 1, n_times) geo = geo(times) result = geo.shape self.assertAllClose(result, expected, atol)
def test_exp_connection_metric(self, dim, tangent_vec, base_point): sphere = Hypersphere(dim) connection = Connection(dim) point_ext = sphere.spherical_to_extrinsic(base_point) vector_ext = sphere.tangent_spherical_to_extrinsic( tangent_vec, base_point) connection.christoffels = sphere.metric.christoffels expected = sphere.metric.exp(vector_ext, point_ext) result_spherical = connection.exp(tangent_vec, base_point, n_steps=50, step="rk4") result = sphere.spherical_to_extrinsic(result_spherical) self.assertAllClose(result, expected)
def test_log_connection_metric(self, dim, point, base_point, atol): sphere = Hypersphere(dim) connection = Connection(dim) connection.christoffels = sphere.metric.christoffels vector = connection.log(point=point, base_point=base_point, n_steps=75, step="rk4", tol=1e-10) result = sphere.tangent_spherical_to_extrinsic(vector, base_point) p_ext = sphere.spherical_to_extrinsic(base_point) q_ext = sphere.spherical_to_extrinsic(point) expected = sphere.metric.log(base_point=p_ext, point=q_ext) self.assertAllClose(result, expected, atol)