Skip to content

Stefan-Endres/hyperct

Repository files navigation

hyperct

Low memory simplicial complex structures via hypercube triangulations and sub-triangulations.

When to use hyperct

  • Dynamic meshes with changing topologies: The library is based on efficiently tracking vertex-vertex connections only which avoids the computational expense of storing simplexes while still allowing many important operations that are applied on simplicial complex structures. Generation-based refinement lets you locally refine and split simplices without rebuilding the entire complex.
  • Computing homologies of very high-dimensional spaces: the hypercube triangulation scales to hundreds of dimensions while symmetric space reduction cuts complexity by up to O(n!).
  • Working with connectivity of high-dimensional data: the simplicial complex exposes vertex adjacency, cell membership, and dual mesh structure directly.

When not to use hyperct

If you need fast conventional computational geometry in low dimensions, dedicated libraries will outperform hyperct:

Features

  • Triangulates high-dimensional domains (10D+)
  • Symmetry constraints to reduce complexity by O(n!)
  • Scalar and vector field associations
  • Inequality constraints for non-convex domains
  • Multiple refinement strategies (local, global, generation-based)
  • Optional GPU acceleration via PyTorch

Installation

pip install hyperct

Optional dependencies

  • hyperct[gpu] — PyTorch backend for GPU-accelerated field evaluation and batch vertex processing. Auto-detects CUDA; falls back to CPU when unavailable.
  • hyperct[plotting] — Matplotlib-based visualization of triangulations, scalar fields, and dual meshes (1D/2D/3D). Includes Polyscope for interactive 3D dual mesh visualization.
  • hyperct[dev] — pytest, coverage, and benchmark tooling.
pip install hyperct[gpu]
pip install hyperct[plotting]
pip install hyperct[gpu,plotting]

Quick start

from hyperct import Complex

# Triangulate a 3D unit hypercube
C = Complex(3)
C.triangulate()
C.split_generation()
C.split_generation()

GPU-accelerated field evaluation

from hyperct import Complex

def my_field(x):
    return sum(xi**2 for xi in x)

C = Complex(3, func=my_field, backend='gpu')
C.triangulate()
C.split_generation()

Requirements

  • Python >= 3.7
  • NumPy >= 1.16.0
  • Optional: PyTorch >= 2.0 (GPU backend)
  • Optional: matplotlib >= 3.0, polyscope (plotting)

License

MIT

About

Low memory hypercube triangulations and sub-triangulations

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors