holonomy_lib
Geometry, graph and topology primitives for PyTorch. Most functions take a batch of inputs (a leading batch dimension) and run on the device and dtype you pass in.
Install
Python 3.12 or later. Install PyTorch for your hardware first, using the PyTorch selector, then:
pip install holonomy-lib
Example
Effective resistance between the ends of a three-node path and of a triangle, computed as one batch:
import torch
from holonomy_lib.spectral import effective_resistance
device = "cuda" if torch.cuda.is_available() else "cpu" # ROCm builds also use "cuda"
adjacency = torch.tensor([
[[0, 1, 0], [1, 0, 1], [0, 1, 0]], # path 0-1-2
[[0, 1, 1], [1, 0, 1], [1, 1, 0]], # triangle
], dtype=torch.float64, device=device)
R = effective_resistance(adjacency)
print(R.shape) # torch.Size([2, 3, 3])
print(R[:, 0, 2]) # tensor([2.0000, 0.6667], dtype=torch.float64)
What's in it
CONTENTS.md lists every function with its signature and the paper it implements.
| Subpackage | Contents |
|---|---|
manifolds |
Fixed-rank, SPD, Lorentz, Lorentzian, stereographic and product manifolds; model-space volumes. |
optimization |
Riemannian SGD. |
hyperbolic |
Fréchet means, manifold-aware inner products, hyperbolic heat kernels. |
lie |
SO(3) exponential and logarithm, rotations, real spherical harmonics. |
info_geometry |
Bregman and KL divergences, Fisher information, natural gradients. |
tensor_calculus |
Mode unfolding, mode products, HOSVD. |
algebra |
Truncated SVD, dense and sparse eigensolvers, conjugate gradient, LSQR. |
convex |
Regularized least squares. |
spectral |
Graph Laplacians, embeddings, heat diffusion, effective resistance, spectral dimension. |
discrete_geometry |
Ollivier and Forman curvature, Ricci flow with surgery. |
sheaf |
Graph sheaves, coboundaries, sheaf Laplacians and their spectra. |
simplicial |
Dense and sparse simplicial complexes, boundary operators, Vietoris-Rips. |
topology |
Hodge Laplacians, Betti numbers, persistent homology. |
Explorer
holonomy-explorer opens a local page that runs the library live: curvature
and diffusion on graphs, geodesics as curvature passes through zero,
persistent homology of point clouds, and batch-size timings on your hardware.
Options: --device, --dtype, --port, --no-browser.
Experimental
holonomy_lib.experimental holds two unfinished pieces that are not part of
the stable API:
hyperbolic_laplacian_eigenmaps: nothing in its objective keeps nodes apart, so an embedding can collapse to a point.HeterogeneousKappaManifold: a curvature per point. Itsdissimilarityis not a metric.
Limits
- Use
float64when accuracy matters. - Sparse eigensolvers, sparse simplicial complexes and sheaves handle one instance at a time. Sparse eigensolvers are not differentiable.
- Persistent homology runs its reduction one batch member at a time on the CPU.
- Ollivier curvature uses entropy-regularized transport, so it is close to the exact value rather than equal to it, and it warns if the solver did not converge. Edge weights act as both lengths and random-walk weights.
- Gradients through
cgcan be wrong when it converges in very few iterations. - Effective resistance and commute time are
infbetween disconnected components.
Development
uv sync --extra dev
python -m pytest -q
python -m ruff check src/ tests/
python -m mypy src/
python tools/audit.py src/holonomy_lib --strict
CONVENTIONS.md has the coding and numerical rules; CHANGELOG.md has the release history.
Citation
@software{holonomy_lib,
author = {John Vaught},
title = {holonomy\_lib: Batched PyTorch primitives for geometry and topology},
version = {0.8.0},
year = {2026},
url = {https://github.com/Synoros-io/holonomy_lib},
}
Please also cite the papers named in the docstrings of the functions you use.
License
FSL-1.1-ALv2. You can use and modify it freely; competing commercial use is reserved to Synoros. Each release becomes Apache-2.0 two years after it ships. Releases up to 0.7.0 remain AGPL-3.0-or-later. For other terms, contact contact@synoros.io.
Metadata
Release files for holonomy-lib 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| holonomy_lib-0.8.0.tar.gz | 231.9 kB | With provenance | Details for holonomy_lib-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| holonomy_lib-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for holonomy_lib-0.8.0-py3-none-any.whl |
Total release size: 502.2 kB
Release files / holonomy_lib-0.8.0.tar.gz
| Download URL | holonomy_lib-0.8.0.tar.gz |
|---|---|
| Size | 231.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71304e8617842e2e573a6478876bd1fd9bc3d193ddde38d533755647bf058fdc
|
|
BLAKE2b-256 checksum How to use checksums |
b26abd45b4970f772db2638b76413596ad835107851681c6bac24820fca0aff9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logRelease files / holonomy_lib-0.8.0-py3-none-any.whl
| Download URL | holonomy_lib-0.8.0-py3-none-any.whl |
|---|---|
| Size | 270.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2766e56310b65d86848be1021344c2fbfb021887ad65b16a931c36ce80f7b444
|
|
BLAKE2b-256 checksum How to use checksums |
6342914d00f7cb9c7fa542e19a6616ddd758dc4441a305134a8c1b467b839431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logSecurity for holonomy-lib 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for holonomy_lib-0.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.