Releases: SuperInstance/constraint-theory-python
Releases · SuperInstance/constraint-theory-python
v0.1.0 — First Release: Exact Geometry for Python
Python bindings for Constraint Theory — snap vectors to exact Pythagorean coordinates with zero floating-point drift, powered by Rust.
Quick Example
from constraint_theory import PythagoreanManifold, snap
# Using the class
manifold = PythagoreanManifold(density=200)
x, y, noise = manifold.snap(0.577, 0.816)
print(f"Snapped: ({x:.4f}, {y:.4f}), noise: {noise:.6f}")
# Output: Snapped: (0.6000, 0.8000), noise: 0.0236
# Using the convenience function
x, y, noise = snap(0.577, 0.816, density=200)Key Features
- Zero Drift — Vectors snap to exact Pythagorean triples (3/5, 4/5, etc.)
- Blazing Fast — Rust-powered KD-tree lookups in ~100ns via PyO3 bindings
- Batch Processing — SIMD-accelerated batch operations for thousands of vectors
- Cross-Platform Determinism — Same results on any machine, any architecture
- Simple API — Just
snap()andsnap_batch()— no configuration needed
Installation
pip install constraint-theoryCore Crate
This package provides Python bindings for the Rust implementation:
constraint-theory-core
What's Next
- Higher-dimensional generalizations (3D Pythagorean quadruples)
- GPU implementations (CUDA, WebGPU)
- More language bindings