pub struct PoincareBall<T> {
pub c: T,
}Expand description
Poincare ball model of hyperbolic geometry.
The open ball (\mathbb{B}^d_c = {x \in \mathbb{R}^d : c|x|^2 < 1}) equipped with the Riemannian metric
[ g_x = \lambda_x^2 I, \quad \lambda_x = \frac{2}{1 - c|x|^2} ]
where (\lambda_x) is the conformal factor. As (|x| \to 1/\sqrt{c}), (\lambda_x \to \infty), so distances near the boundary grow without bound – this is how infinite hierarchical depth fits in a finite Euclidean volume.
Curvature: the sectional curvature is (-c) everywhere. Larger (c) means stronger negative curvature (more “room” for tree branching). The standard choice is (c = 1).
Key operations: all defined via Mobius gyrovector space arithmetic (Ungar, 2008). See individual method docs for formulas.
Fields§
§c: TCurvature parameter (c > 0)
Implementations§
Source§impl<T> PoincareBall<T>
impl<T> PoincareBall<T>
Sourcepub fn mobius_add(
&self,
x: &ArrayView1<'_, T>,
y: &ArrayView1<'_, T>,
) -> Array1<T>
pub fn mobius_add( &self, x: &ArrayView1<'_, T>, y: &ArrayView1<'_, T>, ) -> Array1<T>
Mobius addition in the Poincare ball (gyrovector space operation).
[ x \oplus_c y = \frac{(1 + 2c\langle x,y\rangle + c|y|^2),x + (1 - c|x|^2),y} {1 + 2c\langle x,y\rangle + c^2|x|^2|y|^2} ]
This is the non-commutative, non-associative “addition” that replaces Euclidean vector addition in hyperbolic space. It satisfies:
- (x \oplus_c 0 = x) (identity)
- (x \oplus_c (-x) = 0) (inverse)
- Left cancellation: ((-x) \oplus_c (x \oplus_c y) = y)
Sourcepub fn distance(&self, x: &ArrayView1<'_, T>, y: &ArrayView1<'_, T>) -> T
pub fn distance(&self, x: &ArrayView1<'_, T>, y: &ArrayView1<'_, T>) -> T
Hyperbolic distance in the Poincare ball.
[ d_c(x, y) = \frac{2}{\sqrt{c}},\mathrm{arctanh}\bigl(\sqrt{c},|(-x) \oplus_c y|\bigr) ]
This is the geodesic distance on the Riemannian manifold ((\mathbb{B}^d_c, g)). Near the origin it approximates (2|x - y|); near the boundary it grows logarithmically in (1/(1-c|x|^2)).
Sourcepub fn log_map_zero(&self, y: &ArrayView1<'_, T>) -> Array1<T>
pub fn log_map_zero(&self, y: &ArrayView1<'_, T>) -> Array1<T>
Logarithmic map at the origin: (\log_0(y) = \frac{\mathrm{arctanh}(\sqrt{c}|y|)}{\sqrt{c}|y|},y).
Maps a point on the manifold to a tangent vector at the origin. For small (|y|), this is approximately the identity.
Sourcepub fn exp_map_zero(&self, v: &ArrayView1<'_, T>) -> Array1<T>
pub fn exp_map_zero(&self, v: &ArrayView1<'_, T>) -> Array1<T>
Exponential map at the origin: (\exp_0(v) = \frac{\tanh(\sqrt{c}|v|)}{\sqrt{c}|v|},v).
Maps a tangent vector at the origin to a point on the manifold. The (\tanh) ensures the result stays inside the ball ((\tanh(t) < 1) for all (t)).
Sourcepub fn is_in_ball(&self, x: &ArrayView1<'_, T>) -> bool
pub fn is_in_ball(&self, x: &ArrayView1<'_, T>) -> bool
Check if point is inside the Poincare ball (||x|| < 1/sqrt(c)).
Sourcepub fn project(&self, x: &ArrayView1<'_, T>) -> Array1<T>
pub fn project(&self, x: &ArrayView1<'_, T>) -> Array1<T>
Project point onto ball boundary if outside.
Trait Implementations§
Source§impl Manifold for PoincareBall<f64>
Available on crate feature ndarray only.
impl Manifold for PoincareBall<f64>
ndarray only.