Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .cursorrules

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: geometric-intelligence/bispectrum
slug: anonymous/bispectrum
516 changes: 0 additions & 516 deletions DESIGN.md

This file was deleted.

47 changes: 39 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# bispectrum

[![Tests](https://github.com/geometric-intelligence/bispectrum/actions/workflows/tests.yml/badge.svg)](https://github.com/geometric-intelligence/bispectrum/actions/workflows/tests.yml)
[![Pre-commit](https://github.com/geometric-intelligence/bispectrum/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/geometric-intelligence/bispectrum/actions/workflows/pre-commit.yml)
[![codecov](https://codecov.io/github/geometric-intelligence/bispectrum/graph/badge.svg?token=J6GGY4VK1E)](https://codecov.io/github/geometric-intelligence/bispectrum)
An open-source, fully unit-tested PyTorch library that implements *selective* G-bispectra for seven group actions as differentiable `torch.nn.Module`s, ready to plug into ML pipelines and deep learning architectures.

Bispectrum analysis for machine learning.
The G-bispectrum is a principled *complete* invariant of a signal — it retains all information up to the group action. Selectivity reduces cost from O(|G|²) to O(|G|) for finite groups, and from O(L³) to Θ(L²) coefficients for SO(3) on S².

## Supported Groups

| Module | Group / Domain | Output mode | Complexity (selective) |
|--------|---------------|-------------|----------------------|
| `CnonCn` | C_n on C_n | selective + full | O(n) |
| `SO2onS1` | SO(2) on S¹ | selective + full | O(n) |
| `TorusOnTorus` | T^d | selective + full | O(n) |
| `DnonDn` | D_n on D_n | selective | O(n) |
| `SO2onDisk` | SO(2) on disk | selective | O(L) |
| `SO3onS2` | SO(3) on S² | selective + full | Θ(L²) |
| `OctaonOcta` | chiral octahedral O (24 elements) | selective | 172 coefficients |

`SO2onS1` is the continuous-n limit of `CnonCn` and shares its implementation.

## API

Every module exposes a uniform interface:

- **`forward(f)`** — selective (default) or full bispectral invariants
- **`fourier(f)`** — group Fourier coefficients
- **`invert(beta)`** — signal reconstruction up to group-action indeterminacy (where available)

Modules default to O(|G|) selective coefficients; pass `selective=False` for the full O(|G|²) set. CG matrices, DFT kernels, and Bessel roots are precomputed as non-learnable buffers. Dependencies: PyTorch, NumPy, and `torch_harmonics` (for `SO3onS2`).

## Benchmarks

Median wall-clock on a single NVIDIA H100 80 GB GPU (batch=16, `torch.utils.benchmark`):

| Module | Group | \|G\| / L_max | Coefs (sel.) | Coefs (full) | Fwd sel. (ms) | Fwd full (ms) |
|--------|-------|-----------|------------|-------------|--------------|----------------|
| `CnonCn` | C_128 | 128 | 128 | 8,256 | 0.14 | 8.53 |
| `TorusOnTorus` | C_32 × C_32 | 1,024 | 1,024 | 524,800 | 0.07 | 0.31 |
| `DnonDn` | D_32 | 64 | 245 | — | 0.57 | — |
| `SO2onDisk` | SO(2) | L=16 | 105 | — | 0.22 | — |
| `SO3onS2` | SO(3) | L=16 | 430 | — | 0.48 | — |
| `OctaonOcta` | O | 24 | 172 | — | 0.68 | — |

## Installation

Expand All @@ -21,8 +56,6 @@ uv pip install bispectrum
### Development

```bash
git clone https://github.com/geometric-intelligence/bispectrum.git
cd bispectrum
uv pip install -e ".[dev]"
pre-commit install
```
Expand Down Expand Up @@ -81,8 +114,6 @@ beta = bsp(f) # shape (4, 172), complex64
f_rec = bsp.invert(beta) # reconstructed up to group action
```

See [DESIGN.md](DESIGN.md) for the full API and all supported groups.

## License

MIT
Binary file removed benchmarks/figures/bench1_coefficient_count.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench1_coefficient_count.png
Binary file not shown.
Binary file removed benchmarks/figures/bench2_forward_cpu.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench2_forward_cpu.png
Binary file not shown.
Binary file removed benchmarks/figures/bench2_forward_gpu.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench2_forward_gpu.png
Binary file not shown.
Binary file removed benchmarks/figures/bench3_inversion_cpu.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench3_inversion_cpu.png
Binary file not shown.
Binary file removed benchmarks/figures/bench3_inversion_gpu.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench3_inversion_gpu.png
Binary file not shown.
Binary file removed benchmarks/figures/bench4_gpu_scaling.pdf
Binary file not shown.
Binary file removed benchmarks/figures/bench4_gpu_scaling.png
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig1.pdf
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig1.png
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig2.pdf
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig2.png
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig3.pdf
Binary file not shown.
Binary file removed benchmarks/figures/paper_fig3.png
Binary file not shown.
23 changes: 0 additions & 23 deletions benchmarks/figures/table_benchmarks.tex

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed benchmarks/inversion_results/inversion_errors.pdf
Binary file not shown.
Binary file removed benchmarks/inversion_results/inversion_errors.png
Binary file not shown.
18 changes: 0 additions & 18 deletions benchmarks/inversion_results/inversion_stats.tex

This file was deleted.

Binary file removed benchmarks/paper_benchmarks.pdf
Binary file not shown.
190 changes: 0 additions & 190 deletions benchmarks/paper_benchmarks.tex

This file was deleted.

Binary file removed docs/beamer_slides.pdf
Binary file not shown.
Loading
Loading