Manifolds¶
Each surface is a class implementing a shared three-method interface:
project a vector into the tangent plane, project a stray point back onto the
surface, and sample noise that already lies in the tangent plane. Every
method has a vectorized _multiple twin that takes an (N, d) array, and
those are what the simulators call.
See driving the manifolds directly for worked examples, including how to add a surface of your own.
Manifold¶
Manifold ¶
Bases: ABC
Abstract base class for manifold implementations.
A manifold is a space that has constraints.
Every subclass of Manifold should implement methods to project vectors onto tangent spaces, project points back onto the manifold and sample tangent-space noise.
project_to_tangent
abstractmethod
¶
Projects a vector v onto the tangent space at point x.
The tangent space is directions that a point x is able to move to while it stays on the manifold. It is also known as the local approximation at a point.
The vector v may be pointing to the manifold, violating the geometry of the manifold, or pointing off the manifold. This method ensures that the returned vector satisfies manifold constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the manifold. |
required | |
v
|
The vector to project. |
required |
Returns:
| Type | Description |
|---|---|
|
A tangent vector at x. |
Source code in src/wanderwalk/manifolds/base.py
project_to_manifold
abstractmethod
¶
Projects a point x onto the manifold.
The point x may be slightly off of the manifold due to numerical computations throughout the algorithm. This method ensures the point x is projected back onto the manifold before it is used again.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point that may not be on the manifold. |
required |
Returns:
| Type | Description |
|---|---|
|
A point on the manifold. |
Source code in src/wanderwalk/manifolds/base.py
sample_tangent_noise
abstractmethod
¶
Generates a vector which lies in the tangent space at point x. It represents sample noise because the returned vector is random.
Random Euclidean noise does not always keep the point x on the manifold. This method ensures that the generated noise lies entirely within the tangent space at point x on the manifold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the manifold. |
required |
Returns:
| Type | Description |
|---|---|
|
A noise vector in tangent space. |
Source code in src/wanderwalk/manifolds/base.py
Sphere¶
Sphere ¶
Bases: Manifold
The Sphere class represents the unit sphere manifold. Points on the manifold must therefore remain normalized and noise must be tangent to the sphere.
Since points on the manifold must be normalized, the magnitude of a point x is equal to 1 (unit length). The tangent vector v of a point x satisfies dot product of x and v is equal to 0. This means they are orthogonal to each other and the tangent vector v is on the tangent space of x.
The Sphere class contains methods to ensure these constraints, as well as a method to compute the Euler-Maruyama step for the next position which is also on the manifold.
project_to_manifold ¶
Normalizes a point x, ensuring it is a point on the sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in R^3 that may or may not lie on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
The normalized form of point x. |
Source code in src/wanderwalk/manifolds/sphere.py
project_to_manifold_multiple ¶
Normalizes more than one point (all the points are defined as X), ensuring they are all on the sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
Many points in R^3 that may or may not lie on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
The normalized form of all of the points of X. |
Source code in src/wanderwalk/manifolds/sphere.py
project_to_tangent ¶
Removes the radial component and only returns the tangential component of vector v at point x. This makes vector v lie in the tangent space of point x, which represents all the possible directions the point x can move while staying on the sphere.
Uses the formula
v_tangential = v - (dot product of v and x)x
This removes the component of vector v in the direction of x, leaving only the component orthogonal to x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the sphere. |
required | |
v
|
The tangent vector in R^3 at point x, which may or may not be tangent at point x. |
required |
Returns:
| Type | Description |
|---|---|
|
The component of vector v which lies in the tangent space |
|
|
at point x. |
Source code in src/wanderwalk/manifolds/sphere.py
project_to_tangent_multiple ¶
Removes the radial component and only returns the tangential component of every vector in the group of vectors V at every point in the group of points X. This makes each vector in V lie in the tangent space of its respective point in the group of points X, which represents all the possible directions the point can move while staying on the sphere.
Uses the formula
v_tangential = v - (dot product of v and x)x
This removes the component of a vector in the direction of a point, leaving only the component orthogonal to the point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
A set of points on the sphere. |
required | |
V
|
A set of tangent vectors in R^3 which correspond to a point in X, which may or may not be tangent at that point. |
required |
Returns:
| Type | Description |
|---|---|
|
The component of each vector in V which lies in the tangent space |
|
|
of its respective point in X. |
Source code in src/wanderwalk/manifolds/sphere.py
sample_tangent_noise ¶
Generates a random Gaussian vector in R^3 and projects it onto the tangent space at point x, which is on the sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
A random Gaussian vector in R^3 which is on the tangent space |
|
|
at point x on the sphere. |
Source code in src/wanderwalk/manifolds/sphere.py
sample_tangent_noise_multiple ¶
Generates random Gaussian vectors for many points in R^3 on the sphere and projects each vector onto the tangent space of its respective point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
A set of points on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
A set of random Gaussian tangent vectors in R^3. |
Source code in src/wanderwalk/manifolds/sphere.py
sample_tangent_noise_anisotropic ¶
Chooses one tangent direction at point x, generates one Gaussian random number and scales that tangent direction by the random number. This generates Brownian noise in only one tangent direction at point x on the sphere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
A random Gaussian tangent vector in R^3 at point x whose motion is |
|
|
constrained to only one tangent direction. |
Source code in src/wanderwalk/manifolds/sphere.py
sample_tangent_noise_anisotropic_multiple ¶
Generates anisotropic noise for many points on the sphere. Each point can only move in one fixed tangent direction, which is scaled by one scalar Gaussian random noise variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
A set of points on the sphere. |
required |
Returns:
| Type | Description |
|---|---|
|
Random Gaussian tangent vectors in R^3. |
Source code in src/wanderwalk/manifolds/sphere.py
euler_maruyama_step ¶
Simulates one step of Brownian motion from point x to the next point on the sphere. Noise is first generated for point x and then scaled by the square root of the time step. Then the next point becomes the previous plus the scaled noise and must be projected onto the sphere.
Variance measures how spread out the random positions are. It grows linearly with time (t). Standard deviation is the square root of variance and represents the net displacement (the distance from the start). Hence, the distance the walker travels from the starting point increases with the square root of t.
The formula used to find the noise scaled is
Change in W_t = square root of change in t * Z, Z ~ N(0, 1)
where change in W_t is the total random change in the system for the respective time step, t is the time step and Z is the standard normal random noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the sphere. |
required | |
dt
|
A time step. |
required |
Returns:
| Type | Description |
|---|---|
|
The next point on the sphere. |
Source code in src/wanderwalk/manifolds/sphere.py
Torus¶
Torus ¶
Bases: Manifold
The Torus class defines a geometric representation of a torus in R^3. It stores the torus parameters R and r, the major and minor radius, respectively.
The class also includes methods for parameterization (converting between torus coordinates (u, v) and Cartesian coordinates (x, y, z)), computing surface normals and tangent directions, projecting points in R^3 onto the torus surface, and simulating Brownian motion using the Euler-Maruyama method.
The Torus class ensures that all simulated points are constrained to the torus manifold for each step to an updated position on the torus. It also enables simulations to store the trajectory a point takes after many time steps.
Initializes the major and minor radii that define the torus' geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
R
|
Distance from the center of the central hole to the center of the tube. |
required | |
r
|
Radius of the tube. |
required |
Source code in src/wanderwalk/manifolds/torus.py
parametrize ¶
Converts parameters (u, v) on the torus to Cartesian (x, y, z) coordinates. Uses formulas
x(u, v) = (R + rcos(v))cos(u) y(u, v) = (R + rcos(v))sin(u) z(u, v) = rsin(v)
The toroidal angle (u) ranges from 0 to 2 pi and rotates around the main z-axis. The poloidal angle (v) ranges from 0 to 2 pi and rotates around the circular cross section of the tube.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
The toroidal angle of the torus. |
required | |
v
|
The poloidal angle of the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
The Cartesian coordinates of a point on the torus. |
Source code in src/wanderwalk/manifolds/torus.py
normal_vector ¶
Computes the unit normal vector at a point on the torus. The normal vector points perpendicular to the torus (away from the tube at that location).
Uses the analytic formula for the torus normal, expressed as
N(u, v) = (cos(u)cos(v), sin(u)cos(v), sin(v))
The Cartesian components of the normal vector are
x = cos(u)cos(v), y = sin(u)cos(v), z = sin(v)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
The toroidal angle of the torus. |
required | |
v
|
The poloidal angle of the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
The Cartesian coordinates of the unit normal vector at a |
|
|
point on the torus. |
Source code in src/wanderwalk/manifolds/torus.py
angles_from_point ¶
Recovers the angles (u, v) from a Cartesian point. Inverse of parametrize.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the torus in R^3. |
required |
Returns:
| Type | Description |
|---|---|
|
A tuple (u, v) of the toroidal and poloidal angles of x. |
Source code in src/wanderwalk/manifolds/torus.py
angles_from_points ¶
Vectorized version of angles_from_point for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 3) array of points on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
A tuple (u, v) of (N,) arrays holding the toroidal and poloidal |
|
|
angles of each point in X. |
Source code in src/wanderwalk/manifolds/torus.py
project_to_tangent ¶
Projects a vector v onto the tangent plane at a point x on the torus.
Takes a Cartesian point, matching the signature shared by every manifold. Recovers the angles from x, then defers to project_to_tangent_at_angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the torus in R^3. |
required | |
v
|
An arbitrary vector in R^3 at point x. |
required |
Returns:
| Type | Description |
|---|---|
|
The component of v which lies in the tangent plane at x. |
Source code in src/wanderwalk/manifolds/torus.py
project_to_tangent_multiple ¶
Vectorized version of project_to_tangent for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 3) array of points on the torus. |
required | |
V
|
An (N, 3) array of vectors, one per point in X. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 3) array holding the tangential component of each vector |
|
|
in V at its corresponding point in X. |
Source code in src/wanderwalk/manifolds/torus.py
project_to_tangent_at_angles ¶
Projects a vector onto the tangent plane of the torus. This is done by removing the normal component of the vector and only leaving the tangential component.
The dot product of the vector and the unit normal vector measures how much of the vector points in the normal direction (away from the torus). When multiplied by the unit normal vector, it is the normal component of the vector.
The formula used to find the tangential component of the vector is
tangential_vector = vector - (dot product of vector and N) * N
where N is the normal vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
The toroidal angle of the torus. |
required | |
v
|
The poloidal angle of the torus. |
required | |
vector
|
An arbitrary vector. |
required |
Returns:
| Type | Description |
|---|---|
|
The tangential vector at (u, v). |
Source code in src/wanderwalk/manifolds/torus.py
project_to_manifold_multiple ¶
Vectorized version of project_to_manifold for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 3) array of points in R^3 that may or may not lie on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 3) array containing the nearest point on the torus for |
|
|
each input point. |
Source code in src/wanderwalk/manifolds/torus.py
sample_tangent_noise_multiple ¶
Vectorized version of sample_tangent_noise for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 3) array of points on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 3) array of random tangent vectors, one per input point. |
Source code in src/wanderwalk/manifolds/torus.py
sample_tangent_noise ¶
Generates a random Gaussian vector in R^3 and projects it onto the tangent space at point x, which is on the torus.
The Cartesian point x is first converted into its corresponding parameters (u, v) using the torus' geometry.
Then, the derivative of X with respect to u and the derivate of X with respect to v are calculated. Both of them are normalized. These are the tangent drections (perpendicular to each other) on the surface.
Two Gaussian random vectors are generated, multiplied to each tangent direction, and then summed to produce a single vector. This is the random step the point takes on the torus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
A random vector in R^3 which is on the tangent space at point |
|
|
x on the torus. |
Source code in src/wanderwalk/manifolds/torus.py
sample_tangent_noise_anisotropic ¶
Generated anistropic noise in one tangent direction at point x on the torus.
A torus has two orthogonal tangent direction: - The direction around the large circle of the torus (R) - The direction around the smaller circular cross-sections of the torus (r)
The toroidal direction is the motion around the large circle, while the poloidal direction is the motion around the cross-section.
A Gaussian random vector is first generated and then multiplied by a scalar value (the noise). This is the random step the point takes on the torus, constrained to one tangent direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
A random vector in R^3 constrained to one tangent direction |
|
|
and at point x on the torus. |
Source code in src/wanderwalk/manifolds/torus.py
sample_tangent_noise_anisotropic_multiple ¶
Generates anistropic Gaussian noise for many points on the torus.
For each point, a scalar Gaussian variable (the noise) is multiplied by one tangent direction (e_u). Here, this is the direction around the large circle of the torus (R).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 3) array of points on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 3) array of random Gaussian tangent vectors. |
Source code in src/wanderwalk/manifolds/torus.py
project_to_manifold ¶
Projects a point in R^3 onto the torus. The projection is computed analytically rather than numerically.
A torus consists of a large circle (radius R) and small circles (radius r) on every cross-section of the large circle.
First, the nearest point on the major circle of radius R in the xy-plane is computed. This point is used as the center of the nearest tube cross-section of the torus. The offset is then computed from the tube center to the input point. It is normalized and scaled to the length of the tube's radius, which is r. The endpoint of the scaled offset vector is the nearest point on the torus, which is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in R^3 that may or may not be on the torus. |
required |
Returns:
| Type | Description |
|---|---|
|
The nearest point on the torus from the input point. |
Source code in src/wanderwalk/manifolds/torus.py
euler_maruyama_step ¶
Simulates one step of Brownian motion from point x to the next point on the torus. Noise is first generated for point x and then scaled by the square root of the time step. Then the next point becomes the previous plus the scaled noise and must be projected onto the torus.
Variance measures how spread out the random positions are. It grows linearly with time (t). Standard deviation is the square root of variance and represents the net displacement (the distance from the start). Hence, the distance the walker travels from the starting point increases with the square root of t.
The formula used to find the noise scaled is
Change in W_t = square root of change in t * Z, Z ~ N(0, 1)
where change in W_t is the total random change in the system for the respective time step, t is the time step and Z is the standard normal random noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point on the torus. |
required | |
dt
|
A time step. |
required |
Returns:
| Type | Description |
|---|---|
|
The next point on the torus. |
Source code in src/wanderwalk/manifolds/torus.py
PoincareDisk¶
PoincareDisk ¶
Bases: Manifold
The PoincareDisk class represents the hyperbolic plane H^2 using the Poincare disk model: the open unit disk {(x, y) : x^2 + y^2 < 1} in R^2, equipped with the conformal metric g_ij = lambda(x,y)^2 * delta_ij where lambda(x,y) = 2 / (1 - x^2 - y^2).
Unlike Sphere and Torus, H^2 has no isometric embedding into R^3 (Hilbert's theorem), so points here are 2D vectors.
Every formula in this class is derived step by step in docs/writeups/2-poincare-disk-derivation.md, starting from this project's own stated convention that Brownian motion's generator is half the Laplace-Beltrami operator. In particular:
-
The governing Ito SDE for a point X_t in the disk is driftless: dX_t = lambda(X_t)^{-1} dW_t = ((1 - |X_t|^2) / 2) dW_t
-
The radial process rho_t = 2artanh(|X_t|) (the geodesic distance from the origin) satisfies dRho_t = dBeta_t + (1/2)coth(rho_t) dt. This closed-form target is the primary check for this manifold since H^2 has no stationary distribution to compare against.
Initializes the Poincare disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epsilon
|
How far inside the unit circle a point is clamped to if a numerical step pushes it to or past the boundary. |
1e-10
|
Source code in src/wanderwalk/manifolds/hyperbolic.py
conformal_factor ¶
Computes the conformal factor lambda(x) = 2 / (1 - |x|^2) at a point x in the disk. This is the scalar by which the Euclidean metric is multiplied to get the hyperbolic metric at x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in the open unit disk. |
required |
Returns:
| Type | Description |
|---|---|
|
The conformal factor lambda(x) at point x. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
project_to_tangent ¶
Returns v unchanged.
Unlike Sphere and Torus, which are embedded in R^3 and therefore need to remove the ambient normal component of a vector to obtain a tangent vector, H^2 in the Poincare disk model is intrinsically 2-dimensional: the tangent space at every interior point x is all of R^2, since there is no ambient subspace to restrict to.
Note this method only ensures v lies in the correct 2D subspace (trivially true here), it does not account for the fact that the tangent space's inner product is non-Euclidean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in the disk. |
required | |
v
|
A vector in R^2. |
required |
Returns:
| Type | Description |
|---|---|
|
v, unchanged. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
project_to_tangent_multiple ¶
Vectorized version of project_to_tangent for many points/vectors at once. Returns V unchanged, for every tangent space here is all of R^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
A set of points in the disk. |
required | |
V
|
A set of vectors in R^2, one per point in X. |
required |
Returns:
| Type | Description |
|---|---|
|
V, unchanged. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
sample_tangent_noise ¶
Generates the tangent noise at point x for the Euler-Maruyama step, per the Ito SDE derived in docs/writeups/2-poincare-disk-derivation.md section 3:
sample_tangent_noise(x) = ((1 - |x|^2) / 2) * Z, Z ~ N(0, I_2)
Since project_to_tangent is the identity here, all of the manifold-specific work for turning flat Gaussian noise into the correct tangent noise happens in this scaling factor, which is exactly lambda(x)^{-1}, the inverse conformal factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
A random vector in R^2, scaled for the hyperbolic metric at x. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
sample_tangent_noise_multiple ¶
Vectorized version of sample_tangent_noise for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 2) array of points in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 2) array of random tangent vectors, one per input point. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
project_to_manifold ¶
Clamps a point x back inside the open unit disk if a numerical step has pushed it to or past the boundary.
The true continuous-time process on H^2 never reaches the boundary |x| = 1 in finite time (see docs/writeups/2-poincare-disk-derivation.md section 6). It exists to prevent floating-point arithmetic from producing an undefined or negative (1 - |x|^2), which the conformal factor and the noise scaling in sample_tangent_noise both depend on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in R^2 that may lie at or beyond the unit circle due to numerical error. |
required |
Returns:
| Type | Description |
|---|---|
|
x, unchanged if |x| < 1 - epsilon; otherwise x rescaled |
|
|
radially to have norm exactly 1 - epsilon. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
project_to_manifold_multiple ¶
Vectorized version of project_to_manifold for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 2) array of points in R^2 that may lie at or beyond the unit circle due to numerical error. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N, 2) array with any offending points rescaled radially to |
|
|
have norm exactly 1 - epsilon. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
euler_maruyama_step ¶
Simulates one step of Brownian motion from point x to the next point in the disk. Noise is first generated for point x (already scaled for the hyperbolic metric, see sample_tangent_noise) and then scaled by the square root of the time step. Then the next point becomes the previous plus the scaled noise, clamped back inside the disk if numerical error pushed it to or past the boundary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in the disk. |
required | |
dt
|
A time step. |
required |
Returns:
| Type | Description |
|---|---|
|
The next point in the disk. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
geodesic_distance_from_origin ¶
Computes the hyperbolic (geodesic) distance from the origin to point x, using the standard Poincare-disk radial distance formula:
rho(x) = 2 * artanh(|x|) = ln((1 + |x|) / (1 - |x|))
This is the arc length of the straight-line radius from the origin to x, measured with the hyperbolic metric (see docs/writeups/2-poincare-disk-derivation.md section 4).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
A point in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
The geodesic distance from the origin to x. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
geodesic_distance_from_origin_multiple ¶
Vectorized version of geodesic_distance_from_origin for many points at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
An (N, 2) array of points in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N,) array of geodesic distances from the origin. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
geodesic_distance ¶
Computes the hyperbolic (geodesic) distance between two points z and w in the disk, using the standard closed-form Poincare-disk distance formula:
d(z, w) = arccosh(1 + 2|z - w|^2 / ((1 - |z|^2)(1 - |w|^2)))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
A point in the disk. |
required | |
w
|
A point in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
The geodesic distance between z and w. |
Source code in src/wanderwalk/manifolds/hyperbolic.py
geodesic_distance_multiple ¶
Vectorized version of geodesic_distance: computes the distance from every point in Z to a single point w.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Z
|
An (N, 2) array of points in the disk. |
required | |
w
|
A single point in the disk. |
required |
Returns:
| Type | Description |
|---|---|
|
An (N,) array of geodesic distances from each point in Z to w. |