Differentiable operators for computational topology and DEC.
Project description
Cochain: differentiable operators for computational topology and DEC
Cochain is a collection of computational topology operators built on PyTorch, designed to facilitate the analysis of discrete topological objects—specifically, simplicial meshes immersed in $\mathbb R^3$ and their associated discrete cochains—within the context of discrete exterior calculus (DEC) and cohomology theory; the underlying chain complexes are defined over $\mathbb{R}$.
Installation
First, follow the PyTorch installation guide to install the correct PyTorch version for your OS and compute platform. Then, install the base cochain package via pip:
pip install cochain
cochain is tested against python>=3.11 and torch>=2.9.0, but it will likely work with older versions of both.
Hardware-accelerated dependencies
Some sparse linear algebra routines require the following additional dependencies to enable CUDA-specific accelerations; currently, cochain is tested against CUDA 12.
CuPy: see the installation guide; version>=14.0.0is required for compatibility withNumPy2.0.nvmath-python: see the installation guide; version>=0.5.0is required because earlier versions lack the sparse linear solver utils.
Optional dependencies
vis: installsPolyscopefor visualization of meshes and cochains.examples: installs meshing utilitiesPyVistaandPyTetWild, which are required for generating some example meshes.
These optional dependency groups can be installed using the standard "extras" bracket notation; e.g.,
pip install cochain[vis,examples]
Features
- Simplicial complexes & combinatorial topology:
- Piecewise-linear triangular and tetrahedral meshes immersed in $\mathbb{R}^3$.
- Coboundary operators (discrete exterior derivatives).
- Reduced coboundary operators via discrete Morse theory.
- Combinatorial Laplacians on both the primal and dual meshes.
- Tree-cotree decomposition for 1-Laplacians on triangular meshes.
- Betti numbers.
- Metric-dependent operators:
- DEC Hodge stars (circumcentric and barycentric duals) and consistent mass matrices.
- DEC Hodge Laplacians (for triangular meshes) and weak Laplacians/stiffness matrices (for tetrahedral meshes).
- Cochain operations & mappings:
- Cup product, anti-symmetrized cup product, and Galerkin ($L^2$-projected) wedge product.
- Galerkin interior product.
- Whitney map and de Rham map.
- Flat and sharp operators for music isomorphism.
- Sparse linear algebra utils:
- Block-diagonal mesh batching.
- PyTorch interfaces for existing sparse linear solvers (SuperLU and cuDSS) and eigensolvers (Lanczos and LOBPCG) that support generalized eigenvalue problems and the shift-invert mode.
- Autograd support for fixed-topology sparse operations.
Planned Features
- Harmonic form generator.
License
This project is licensed under the MIT License; see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cochain-0.1.0a0.tar.gz.
File metadata
- Download URL: cochain-0.1.0a0.tar.gz
- Upload date:
- Size: 436.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa49bb38634bf332200f91992c78a92358b59b48c7eeb18c9ed05bc95757997a
|
|
| MD5 |
09cb72107020eb02c828a5eb29c6c877
|
|
| BLAKE2b-256 |
e90778b442c570169c6e2ba8c35e319c4d8a478863f67292daff555234ee3d02
|
Provenance
The following attestation bundles were made for cochain-0.1.0a0.tar.gz:
Publisher:
publish.yml on luhong88/cochain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cochain-0.1.0a0.tar.gz -
Subject digest:
fa49bb38634bf332200f91992c78a92358b59b48c7eeb18c9ed05bc95757997a - Sigstore transparency entry: 2026568968
- Sigstore integration time:
-
Permalink:
luhong88/cochain@20cd45e1249cc67969264ac9e76dfa3d588fc9ba -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/luhong88
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20cd45e1249cc67969264ac9e76dfa3d588fc9ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file cochain-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: cochain-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 195.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
599b1fcb1d64e98e289961253ac577d0576a7f7833eef09af54e8fdff2c045d2
|
|
| MD5 |
085477aa5ed79a0348b58f01a4b1fcb1
|
|
| BLAKE2b-256 |
c174a50a42690ad058d6f6093cbee056507a93d38897512e18b8e163f3fd47ea
|
Provenance
The following attestation bundles were made for cochain-0.1.0a0-py3-none-any.whl:
Publisher:
publish.yml on luhong88/cochain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cochain-0.1.0a0-py3-none-any.whl -
Subject digest:
599b1fcb1d64e98e289961253ac577d0576a7f7833eef09af54e8fdff2c045d2 - Sigstore transparency entry: 2026569052
- Sigstore integration time:
-
Permalink:
luhong88/cochain@20cd45e1249cc67969264ac9e76dfa3d588fc9ba -
Branch / Tag:
refs/tags/v0.1.0a0 - Owner: https://github.com/luhong88
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@20cd45e1249cc67969264ac9e76dfa3d588fc9ba -
Trigger Event:
push
-
Statement type: