Skip to main content

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.0 is required for compatibility with NumPy 2.0.
  • nvmath-python: see the installation guide; version >=0.5.0 is required because earlier versions lack the sparse linear solver utils.

Optional dependencies

  • vis: installs Polyscope for visualization of meshes and cochains.
  • examples: installs meshing utilities PyVista and PyTetWild, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cochain-0.1.0a0.tar.gz (436.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cochain-0.1.0a0-py3-none-any.whl (195.3 kB view details)

Uploaded Python 3

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

Hashes for cochain-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 fa49bb38634bf332200f91992c78a92358b59b48c7eeb18c9ed05bc95757997a
MD5 09cb72107020eb02c828a5eb29c6c877
BLAKE2b-256 e90778b442c570169c6e2ba8c35e319c4d8a478863f67292daff555234ee3d02

See more details on using hashes here.

Provenance

The following attestation bundles were made for cochain-0.1.0a0.tar.gz:

Publisher: publish.yml on luhong88/cochain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for cochain-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 599b1fcb1d64e98e289961253ac577d0576a7f7833eef09af54e8fdff2c045d2
MD5 085477aa5ed79a0348b58f01a4b1fcb1
BLAKE2b-256 c174a50a42690ad058d6f6093cbee056507a93d38897512e18b8e163f3fd47ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for cochain-0.1.0a0-py3-none-any.whl:

Publisher: publish.yml on luhong88/cochain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page