Convert hyperboloid coordinates to Poincaré ball coordinates.
| Parameters: |
-
X
(Float[Tensor, 'n_points n_dim'])
–
Input coordinates in the hyperboloid model.
|
| Returns: |
-
poincare_coords( Float[Tensor, 'n_points n_dim-1']
) –
Coordinates in the Poincaré ball model.
|
Source code in manify/utils/visualization.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 | def hyperboloid_to_poincare(X: Float[torch.Tensor, "n_points n_dim"]) -> Float[torch.Tensor, "n_points n_dim-1"]:
"""Convert hyperboloid coordinates to Poincaré ball coordinates.
Args:
X: Input coordinates in the hyperboloid model.
Returns:
poincare_coords: Coordinates in the Poincaré ball model.
"""
# Spatial components: all columns except the first
x_space = X[:, 1:]
# Time-like component: first column, reshaped for broadcasting
x_time = X[:, 0:1]
# Convert to Poincaré ball coordinates
poincare_coords = x_space / (1 + x_time)
return poincare_coords
|