Skip to content
Merged
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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
default_stages: [pre-commit]
fail_fast: false
exclude: ^(docs/|paper/)
exclude: ^(docs/|paper/|experiments/)

default_language_version:
python: python3
Expand Down
516 changes: 0 additions & 516 deletions DESIGN.md

This file was deleted.

43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,46 @@
[![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)

Bispectrum analysis for machine learning.
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.

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 Down Expand Up @@ -81,8 +120,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.
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.
Binary file removed benchmarks/paper_benchmarks.pdf
Binary file not shown.
Binary file removed docs/beamer_slides.pdf
Binary file not shown.
Loading
Loading