geometric_kernels.utils.manifold_utils

Utilities for dealing with manifolds.

Module Contents

geometric_kernels.utils.manifold_utils.hyperbolic_distance(x1, x2, diag=False)[source]

Compute the hyperbolic distance between x1 and x2.

The code is a reimplementation of geomstats.geometry.hyperboloid.HyperbolicMetric for lab.

Parameters:
  • x1 (lab.Numeric) – An [N, n+1]-shaped array of points in the hyperbolic space.

  • x2 (lab.Numeric) – An [M, n+1]-shaped array of points in the hyperbolic space.

  • diag (beartype.typing.Optional[bool]) –

    If True, compute elementwise distance. Requires N = M.

    Default False.

Returns:

An [N, M]-shaped array if diag=False or [N,]-shaped array if diag=True.

Return type:

lab.Numeric

geometric_kernels.utils.manifold_utils.manifold_laplacian(x, manifold, egrad, ehess)[source]

Computes the manifold Laplacian of a given function at a given point x. The manifold Laplacian equals the trace of the manifold Hessian, i.e., \(\Delta_M f(x) = \sum_{i=1}^{d} \nabla^2 f(x_i, x_i)\), where \([x_i]_{i=1}^{d}\) is an orthonormal basis of the tangent space at x.

Warning

This function only works for hyperspheres out of the box. We will need to change that in the future.

Parameters:
  • x (lab.Numeric) – A point on the manifold at which to compute the Laplacian.

  • manifold – A geomstats manifold.

  • egrad – Euclidean gradient of the given function at x.

  • ehess – Euclidean Hessian of the given function at x.

Returns:

Manifold Laplacian of the given function at x.

See Jost [2011] (Chapter 3.1) for mathematical details.

geometric_kernels.utils.manifold_utils.minkowski_inner_product(vector_a, vector_b)[source]

Computes the Minkowski inner product of vectors.

\[\langle a, b \rangle = a_0 b_0 - a_1 b_1 - \ldots - a_n b_n.\]
Parameters:
  • vector_a (lab.Numeric) – An […, n+1]-shaped array of points in the hyperbolic space \(\mathbb{H}_n\).

  • vector_b (lab.Numeric) – An […, n+1]-shaped array of points in the hyperbolic space \(\mathbb{H}_n\).

Returns:

An […,]-shaped array of inner products.

Return type:

lab.Numeric

geometric_kernels.utils.manifold_utils.tangent_onb(manifold, x)[source]

Computes an orthonormal basis on the tangent space at x.

Warning

This function only works for hyperspheres out of the box. We will need to change that in the future.

Parameters:
  • manifold – A geomstats manifold.

  • x – A point on the manifold.

Returns:

An [d, d]-shaped array containing the orthonormal basis on manifold at x.