GPU-accelerated differentiable convex hull computation powered by JAX
PolytopAX brings modern computational geometry to the JAX ecosystem, enabling differentiable convex hull computation with GPU acceleration and automatic differentiation for machine learning applications.
- π GPU-Accelerated: Leverage JAX/XLA for high-performance computation
- π Differentiable: Full compatibility with JAX transformations (
jit,grad,vmap) - π― ML-Ready: Seamless integration into machine learning pipelines
- π¦ Easy to Use: Both functional and object-oriented APIs
- π¬ Research-Grade: Built for computational geometry research and applications
pip install polytopaximport jax.numpy as jnp
import polytopax as ptx
# Generate random points
points = jax.random.normal(jax.random.PRNGKey(0), (100, 3))
# Compute convex hull
hull_vertices = ptx.convex_hull(points)
print(f"Hull has {len(hull_vertices)} vertices")
# Object-oriented API
hull = ptx.ConvexHull.from_points(points)
print(f"Volume: {hull.volume():.4f}")
print(f"Surface area: {hull.surface_area():.4f}")
# Check point containment
test_point = jnp.array([0.0, 0.0, 0.0])
is_inside = hull.contains(test_point)import jax
# Differentiable volume computation
def volume_loss(points):
hull = ptx.ConvexHull.from_points(points)
return -hull.volume() # Maximize volume
# Compute gradients
grad_fn = jax.grad(volume_loss)
gradients = grad_fn(points)
# Batch processing with vmap
batch_points = jnp.stack([points, points + 0.1])
batch_volumes = jax.vmap(lambda p: ptx.ConvexHull.from_points(p).volume())(batch_points)convex_hull(points)- Compute convex hull verticespoint_in_convex_hull(point, vertices)- Point containment testconvex_hull_volume(vertices)- Volume computationconvex_hull_surface_area(vertices)- Surface area computation
ConvexHull.from_points(points)- Create from point cloud.volume()- Compute volume.surface_area()- Compute surface area.contains(point)- Test point containment.centroid()- Compute centroid
- Robotics: Path planning and obstacle avoidance
- Machine Learning: Constraint optimization and geometric deep learning
- Computer Graphics: Collision detection and rendering
- Computational Physics: Molecular dynamics and simulations
- Finance: Risk management and portfolio optimization
| Feature | PolytopAX | SciPy | Qhull |
|---|---|---|---|
| GPU Acceleration | β | β | β |
| Differentiable | β | β | β |
| JAX Integration | β | β | β |
| Batch Processing | β | β | β |
| ML Pipeline Ready | β | β | β |
Explore comprehensive examples in the examples/ directory:
- v0.1.0 β Core differentiable convex hull algorithms
- v0.5.0 π Exact algorithms (Quickhull, incremental)
- v0.8.0 π Advanced operations (intersections, Minkowski sums)
- v1.0.0 π― Riemannian manifold integration (β GeomAX)
We welcome contributions! Please see our Contributing Guidelines and Development Setup.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
- Documentation: polytopax.readthedocs.io (coming soon)
- PyPI: pypi.org/project/polytopax (coming soon)
- Issues: GitHub Issues
Built with β€οΈ for the JAX and computational geometry communities