nlgm.manifolds
Module#
- class nlgm.manifolds.BasicManifold(dimension: int, curvature: float, base_point: Tensor = None)[source]#
A base class for manifolds, providing a common interface for dimension, curvature, and base point.
- Args:
dimension (int): The dimension of the manifold. curvature (float): The curvature of the manifold. base_point (torch.Tensor): The origin point of the tangent space.
- class nlgm.manifolds.EuclideanManifold(dimension: int, curvature: float, base_point: Tensor = None)[source]#
- class nlgm.manifolds.HyperbolicManifold(dimension: int, curvature: float, base_point: Tensor = None)[source]#
- class nlgm.manifolds.ProductManifold(curvatures: List[float])[source]#
Represents a product manifold constructed from multiple manifold components, each characterized by its dimension and curvature.
- Args:
curvatures (List[float]): A list containing the curvatures of component manifolds.
- Attributes:
manifolds (List[BasicManifold]): A list of manifold objects representing the components of the product manifold. dimensions (List[int]): A list of dimensions of each component manifold.
Note: dimension of each component manifold is assumed to be 2.
- distance(point_x: Tensor, point_y: Tensor) Tensor [source]#
Computes the distance between two points in the product manifold space.
- Args:
point_x (torch.Tensor): The first point in the product manifold space. point_y (torch.Tensor): The second point in the product manifold space.
- Returns:
torch.Tensor: The distance between the two points in the product manifold space.
- exponential_map(latent_vector: Tensor) Tensor [source]#
Applies the exponential map of each component manifold to the corresponding segment of the input latent vector and returns a concatenated tensor representing the projection into the product manifold space.
- Args:
- latent_vector (torch.Tensor): A latent vector in Euclidean space to be mapped to the product manifold space.
Its dimension should match the sum of the dimensions of the component manifolds.
- Returns:
- torch.Tensor: A tensor representing the projection of the input latent vector into the product manifold space,
preserving the differentiability for gradient-based optimization.
- class nlgm.manifolds.SphericalManifold(dimension: int, curvature: float, base_point: Tensor = None)[source]#