wai-quantum 0.3.27: Gaussian boson sampling, exactly #145
Merged
dcharlot
merged 1 commit from 2026-10-04 20:41:21 -04:00
wai-quantum-gbs into main 2026-10-04
wai-quantum 0.3.27: Gaussian boson sampling, exactly
Some checks failed
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m25s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m3s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m12s
standards workspaces build + test / map-rs (pull_request) Successful in 1m1s
standards workspaces build + test / mesh-rs (pull_request) Successful in 52s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / openpay (pull_request) Successful in 4m8s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m42s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m57s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 14s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 5m15s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 42s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m12s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 24s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 1m45s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 46s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m11s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m0s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m1s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 4m1s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m46s
standards workspaces build + test / arl-rs (pull_request) Successful in 5m0s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 7m4s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 5m28s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 4m36s
standards workspaces build + test / sense-rs (pull_request) Successful in 6m2s
standards workspaces build + test / macOS energy backends (pull_request) Failing after 7m31s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 7m16s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 36s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 2m39s
A photonic sampler's outcome probabilities are hafnians (photon-number
detection) or torontonians (threshold detection) of its Gaussian state.
quantum_gbs computes both exactly and reproducibly.
- hafnian: power traces, a sum over 2^{n/2} pair subsets, each the
lambda^{n/2} coefficient of exp(sum tr(B^k) lambda^k / 2k). The traces come
from a Householder Hessenberg reduction, La Budde's characteristic
polynomial and Newton's identities: O(n^3 2^{n/2}).
- torontonian: inclusion-exclusion over the 2^m clicked-mode subsets.
- Both sums run in 64 fixed chunks, threaded natively and sequential on WASI,
added in chunk order, so the bits do not depend on threading.
- GaussianState: squeezed vacua through an interferometer with uniform loss,
as the complex covariance in the (a, a-dagger) basis.
- click_probability, photon_probability: exact pattern probabilities.
- sample_clicks: exact samples, drawn mode by mode from marginal
torontonians.
- click_marginals, check_samples: the one- and two-mode click statistics
every sampler of the state must reproduce, polynomial in the modes, and a
z-score check of observed patterns against them.
Against an independent implementation:
- click probabilities of three lossy states, every pattern: 1.1e-10;
- photon probabilities up to four photons: 2.3e-13;
- hafnians: 1.5e-12 up to 20x20 and 4.5e-8 at 36x36, where the alternating
sum loses precision on either side. A 36x36 hafnian takes under 2 s.
Tests:
- hafnians match exhaustion over matchings, and (2k-1)!!;
- squeezed vacuum reproduces its textbook click and photon statistics;
- click probabilities sum to one with loss;
- exact samples reproduce marginals and full-pattern frequencies, and pass
the check, while a different interferometer fails it.
Mutating the hafnian sign, La Budde's recurrence, Newton's identities, the
torontonian sign or the loss channel fails a named test. bit_identity pins a
24x24 hafnian and a 14-click torontonian (threaded natively, sequential under
WASI), probabilities, samples and marginals, on both targets.
CLI: wai-quantum gbs --squeezing ... [--eta --seed | --unitary] [--sample K |
--check FILE] [--json], byte-identical natively and under wasm32-wasip2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>