wai-quantum 0.3.28: the dense state vector at any angle, the same bits threaded or not #147

Merged
dcharlot merged 1 commit from wai-quantum-sv into main 2026-10-05 05:06:49 -04:00
Owner

Stacked on #145 → #144 → #143. Merge those in order first. Until then this diff also shows their commits.

What

wai-quantum 0.3.28 adds quantum_sv, the dense state vector at any angle. The byte-exact simulator is fixed-point and dyadic by design. This is the general state vector for everything else: arbitrary rotations, √W, fSim and random unitaries. It is also the ground truth that approximate methods are measured against, up to about 30 qubits.

  • Layout. Real and imaginary parts are held in separate arrays. Qubit 0 is the most significant bit, matching the tensor networks.
  • Kernels. Unrolled one- and two-qubit kernels, a general k-qubit kernel, and a diagonal fast path.
  • Fusion around multi-qubit gates. One-qubit gates are absorbed into the multi-qubit gates on their qubits. Above width 2, adjacent multi-qubit gates also merge. Each move only crosses gates on other qubits, so the unitary is unchanged.
  • Threads, with no unsafe code. Work is split into block-aligned slices. For gates on the top qubits, it is split at the top target bit instead, or into four quarters for adjacent pairs.
  • One arithmetic per amplitude. Every kernel path computes each amplitude through the same row sum, in the same order. Threading therefore never changes a bit.
  • Reductions (norm, Pauli expectations, sorted-uniform sampling) are summed in fixed chunks.
  • gates. The Gate type moves here from quantum_tn and is re-exported there. It comes with the standard gates by name: H, X, Y, Z, S, T, √X/√Y/√W, RX/RY/RZ, phase, CX, CZ, SWAP, iSWAP, CPhase, RZZ and fSim.
  • CLI. wai-quantum sv --file CIRCUIT.jsonl [--fuse W] [--top K | --sample S | --expect "Z0 Z1; X3"] [--json]. tn now shares its circuit reader.

Evidence

Against an independent simulator. Final states of random circuits agree to 2·10⁻¹⁶ at fusion widths 0, 2 and 4. The circuits are phased-XZ rotations, fSim gates and partial iSWAPs on 8, 12 and 16 qubits.

Two methods in one crate. Tensor-network amplitudes equal the state vector's to 10⁻¹² on 18 qubits (tests/tn_vs_sv.rs). This covers five bitstrings and an open-output batch, contracted with sliced plans.

Speed. A 26-qubit, depth-20 circuit of 770 gates runs in about 9 s at fusion width 2, in double precision, on one machine. Unfused it takes 15.5 s. Before the split-path threading and fusion around multi-qubit gates it took 78–124 s.

A determinism bug caught and closed. The first native-vs-WASI pin disagreed:

  • Cause. A threaded path for gates on the top qubits summed matrix rows in a different order from the block kernel that a single thread (or WASI) uses.
  • Fix. Every multi-qubit kernel now goes through one shared row sum.
  • Guard. A native test forces 1, 2, 3, 8 and 32 threads at fusion widths 0–4 and demands identical states and reductions. CI runs the pins natively only, so this is the guard CI can see. Reversing one kernel's sum makes that test fail, and only that test.

Tests

  • Every kernel path matches an independent gate-by-gate reference, including at 16 qubits, where the split paths run.
  • Named-gate identities hold: √X² = X, √Y² = Y, √W² = W, T² = S, S² = Z.
  • Bell-state expectations, sampling balance and expectation values are checked against direct sums.

Pins and suite

  • bit_identity pins a 16-qubit run at widths 0, 2 and 3 that exercises every path. All 13 pins pass natively and under wasm32-wasip2.
  • sv and tn output is byte-identical natively and as a WASI component.
  • cargo test --locked --features full --lib --tests (debug): 377 + 13 + 2 + 1 + 3 passed.
  • Every feature builds alone with zero warnings, and clippy is clean on the new code.

🤖 Generated with Claude Code

**Stacked on #145 → #144 → #143.** Merge those in order first. Until then this diff also shows their commits. ## What `wai-quantum` 0.3.28 adds **`quantum_sv`, the dense state vector at any angle**. The byte-exact simulator is fixed-point and dyadic by design. This is the general state vector for everything else: arbitrary rotations, √W, fSim and random unitaries. It is also the ground truth that approximate methods are measured against, up to about 30 qubits. - **Layout.** Real and imaginary parts are held in separate arrays. Qubit 0 is the most significant bit, matching the tensor networks. - **Kernels.** Unrolled one- and two-qubit kernels, a general k-qubit kernel, and a diagonal fast path. - **Fusion around multi-qubit gates.** One-qubit gates are absorbed into the multi-qubit gates on their qubits. Above width 2, adjacent multi-qubit gates also merge. Each move only crosses gates on other qubits, so the unitary is unchanged. - **Threads, with no unsafe code.** Work is split into block-aligned slices. For gates on the top qubits, it is split at the top target bit instead, or into four quarters for adjacent pairs. - **One arithmetic per amplitude.** Every kernel path computes each amplitude through the same row sum, in the same order. Threading therefore never changes a bit. - **Reductions** (norm, Pauli expectations, sorted-uniform sampling) are summed in fixed chunks. - **`gates`.** The `Gate` type moves here from `quantum_tn` and is re-exported there. It comes with the standard gates by name: H, X, Y, Z, S, T, √X/√Y/√W, RX/RY/RZ, phase, CX, CZ, SWAP, iSWAP, CPhase, RZZ and fSim. - **CLI.** `wai-quantum sv --file CIRCUIT.jsonl [--fuse W] [--top K | --sample S | --expect "Z0 Z1; X3"] [--json]`. `tn` now shares its circuit reader. ## Evidence **Against an independent simulator.** Final states of random circuits agree to **2·10⁻¹⁶** at fusion widths 0, 2 and 4. The circuits are phased-XZ rotations, fSim gates and partial iSWAPs on 8, 12 and 16 qubits. **Two methods in one crate.** Tensor-network amplitudes equal the state vector's to 10⁻¹² on 18 qubits (`tests/tn_vs_sv.rs`). This covers five bitstrings and an open-output batch, contracted with sliced plans. **Speed.** A 26-qubit, depth-20 circuit of 770 gates runs in about 9 s at fusion width 2, in double precision, on one machine. Unfused it takes 15.5 s. Before the split-path threading and fusion around multi-qubit gates it took 78–124 s. **A determinism bug caught and closed.** The first native-vs-WASI pin disagreed: - **Cause.** A threaded path for gates on the top qubits summed matrix rows in a different order from the block kernel that a single thread (or WASI) uses. - **Fix.** Every multi-qubit kernel now goes through one shared row sum. - **Guard.** A native test forces 1, 2, 3, 8 and 32 threads at fusion widths 0–4 and demands identical states and reductions. CI runs the pins natively only, so this is the guard CI can see. Reversing one kernel's sum makes that test fail, and only that test. **Tests** - Every kernel path matches an independent gate-by-gate reference, including at 16 qubits, where the split paths run. - Named-gate identities hold: √X² = X, √Y² = Y, √W² = W, T² = S, S² = Z. - Bell-state expectations, sampling balance and expectation values are checked against direct sums. **Pins and suite** - `bit_identity` pins a 16-qubit run at widths 0, 2 and 3 that exercises every path. All 13 pins pass natively and under `wasm32-wasip2`. - `sv` and `tn` output is byte-identical natively and as a WASI component. - `cargo test --locked --features full --lib --tests` (debug): 377 + 13 + 2 + 1 + 3 passed. - Every feature builds alone with zero warnings, and clippy is clean on the new code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum 0.3.25: error correction at circuit level, sampled, modelled and decoded exactly
All checks were successful
no-vanity-metrics / WAI public text names no comparison (pull_request) Successful in 3s
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 3s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m54s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m26s
standards workspaces build + test / openpay (pull_request) Successful in 4m53s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m12s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m38s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 7m57s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 54s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m59s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 12s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 2m15s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m10s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 26s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 48s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m13s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m2s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m3s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m55s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m44s
standards workspaces build + test / arl-rs (pull_request) Successful in 22m23s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 20m55s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 19m6s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 10m16s
standards workspaces build + test / sense-rs (pull_request) Successful in 7m52s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m59s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 6m11s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 31s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 2m21s
ed592d76f9
quantum_frame takes an error-correction experiment as what it is: a noisy
Clifford circuit with detectors and observables.

- parse reads the ecosystem's circuit text (resets and measurements in Z and
  X, H/S/sqrt(X)/Paulis/CX/CZ/SWAP, flip and depolarizing noise, detectors,
  observables, REPEAT), and refuses anything else rather than skipping it.
- sample is bit-packed Pauli-frame simulation, 64 shots per word, with
  geometric skipping between noise hits; reproducible from
  (circuit, shots, seed).
- error_model derives the detector error model by backward sensitivity
  propagation. It converts depolarizing channels to equivalent independent
  mechanisms exactly, XOR-merges identical ones, and refuses non-deterministic
  detectors. A graphlike mechanism stays one matching edge; otherwise it splits
  into X and Z halves, then into per-qubit parts.
- surface_code_memory generates the rotated surface-code memory experiment.

quantum_match decodes by exact minimum-weight perfect matching: Dijkstra on
integer weights, with boundary paths computed once and dominated pairs cut,
then Edmonds' blossom. memory_experiment and fit_code_model measure
P(d) = a(p/p*)^((d+1)/2): a = 0.023, p* = 0.0100 under uniform circuit
noise, and CodeFit::surface_code feeds that into a resource estimate.

Checked against an independent implementation:
- generated circuits identical byte for byte (135 configurations, d 2-15,
  1-8 rounds);
- error models identical mechanism for mechanism, to 1e-12 in probability
  (41 circuits: rotated and unrotated surface codes in both bases,
  repetition codes);
- decoded logical error rates within 1.4 standard errors on all 12 grid
  points.

tests/frame_reference.rs keeps a circuit and a model from that implementation
as fixtures. Blossom equals brute force on 3000 random graphs. A mirrored
random Clifford circuit over every gate type ties the sampler's forward rules
to the model's backward ones. Mutating the depolarizing conversion, any gate
rule on either side, the determinism check or the decomposition fails a named
test. bit_identity pins sampling, decoding and the fit natively and under
wasm32-wasip2; repro gains an in-crate exp, within an ulp.

CLI: wai-quantum qec [-d --rounds --p --shots --seed --json] | --file |
--circuit | --dem | --fit, and estimate --prefactor/--threshold for a
measured code. Byte-identical natively and under wasm32-wasip2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum 0.3.26: tensor-network contraction, hyper-optimised, sliced, bit-identical
All checks were successful
standards workspaces build + test / proof-rs (pull_request) Successful in 1m12s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 2m14s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m11s
standards workspaces build + test / map-rs (pull_request) Successful in 2m6s
standards workspaces build + test / mesh-rs (pull_request) Successful in 57s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m38s
standards workspaces build + test / openpay (pull_request) Successful in 3m56s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m56s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 14s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m9s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 22s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 5m7s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m9s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 37s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 58s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 1m28s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m0s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m55s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m47s
standards workspaces build + test / arl-rs (pull_request) Successful in 3m54s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 5m38s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 4m46s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 5m49s
standards workspaces build + test / sense-rs (pull_request) Successful in 5m16s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m10s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 7m41s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 40s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 2m19s
ae0d1c4cd4
quantum_tn turns a circuit (any unitary on any qubits, as a matrix) into the
tensor network of one amplitude or an open-output batch, and contracts it.

- Network::amplitude builds the network; simplify absorbs vectors and
  one-qubit gates into neighbours.
- find_path is a seeded hyper-optimiser over two tree families:
  - randomised greedy, scoring size(out)/c - c(size(a)+size(b)) with Gumbel
    noise;
  - recursive bipartition, multilevel (heavy-edge coarsening, several
    initial cuts, refinement at every level), with greedy leaves.
  Families alternate until one leads; later trials sample near the best
  parameters. The best few trees are reconfigured: subtrees of up to eight
  tensors are re-contracted optimally by subset dynamic programming, until
  nothing improves.
- slice fixes the index that leaves the least total work until the largest
  intermediate fits the cap, pricing each candidate incrementally. A second
  search round then finds a tree for the network with the first round's
  slices fixed (all, or the more valuable half).
- contract_plan contracts every slice in a fixed accumulation order and sums
  them in order. Threads are bounded by an 8 GiB budget; WASI runs
  sequentially. The bits are the same everywhere.

Measured on single amplitudes of random circuits on the 54-qubit
advantage-experiment grid (fSim(pi/2, pi/6), staggered couplers), 256 trials,
under ten seconds each, in log10 operations:
  m = 10: 10.48   m = 12: 13.91   m = 14: 14.63   m = 16: 17.60   m = 20: 18.77
An independently developed hyper-optimiser, given the identical networks,
lands within 0.4 of these at every depth, in either direction. The 54-qubit,
10-cycle amplitude, contracted here in 16 slices, agrees with an independent
contraction to 12 significant figures.

Tests:
- Amplitudes match a dense state vector for every tree family, with
  reconfiguration and with slicing.
- Reconfiguration reaches the exact optimum on 40 random small networks.
- Incremental slice pricing matches a full recount.
- The same seed gives the same plan.
- Mutating the permutation, the complex product, the contraction's summed
  indices, slice pricing, the slice offset or the reconfiguration DP fails a
  named test.
- bit_identity pins a plan and its sliced, threaded amplitude natively and
  under wasm32-wasip2.

CLI: wai-quantum tn --file CIRCUIT.jsonl [--bits --open --trials --seed
--cap-log2 --plan-only --json], byte-identical natively and under
wasm32-wasip2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
6ab907e107
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]>
wai-quantum 0.3.28: the dense state vector at any angle, the same bits threaded or not
Some checks failed
standards workspaces build + test / proof-rs (pull_request) Successful in 1m13s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m20s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 50s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m10s
standards workspaces build + test / map-rs (pull_request) Successful in 59s
standards workspaces build + test / mesh-rs (pull_request) Successful in 44s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m38s
standards workspaces build + test / openpay (pull_request) Successful in 3m11s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m56s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 13s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 5m6s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 2m11s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 24s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 38s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 44s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m13s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 2m7s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 57s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 1m2s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m57s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m44s
standards workspaces build + test / arl-rs (pull_request) Successful in 23m30s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 28m45s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 23m46s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 22m26s
standards workspaces build + test / sense-rs (pull_request) Successful in 18m49s
standards workspaces build + test / macOS energy backends (pull_request) Failing after 13m54s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 25m26s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 1m17s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 12m58s
38a205ee33
The byte-exact simulator is fixed-point and dyadic by design. quantum_sv is
the general state vector for everything else (arbitrary rotations, sqrt W,
fSim, random unitaries), and the ground truth approximate methods are
measured against, up to about 30 qubits.

- Split real and imaginary arrays; qubit 0 most significant, as in the
  tensor networks.
- Kernels: unrolled one- and two-qubit, general k-qubit, and a diagonal
  fast path.
- Fusion around multi-qubit gates: pending one-qubit gates join the next
  multi-qubit gate on their qubit, trailing ones the last, and above width 2
  adjacent multi-qubit gates merge. Each move only crosses gates on other
  qubits.
- Threads, with no unsafe code: block-aligned slices, and for gates on the
  top qubits a split at the top target bit, or into four quarters for
  adjacent pairs.
- Every path computes each amplitude through one row sum in one order, so
  threading never changes a bit. The native-vs-WASI pin caught a path whose
  sum ran in a different order; the fix is the shared row_dot, and a test
  now forces 1/2/3/8/32 threads and demands identical states (falsified by
  reversing one kernel's sum).
- Reductions (norm, Pauli expectations, sorted-uniform sampling) are summed
  in fixed chunks.

gates: Gate moves here from quantum_tn (re-exported there), with the
standard gates by name: H, X, Y, Z, S, T, sqrt X/Y/W, RX/RY/RZ, phase, CX,
CZ, SWAP, iSWAP, CPhase, RZZ, fSim.

Checked:
- final states of random circuits on 8, 12 and 16 qubits agree with an
  independent simulator to 2e-16 at fusion widths 0, 2 and 4;
- tensor-network amplitudes equal the state vector's to 1e-12 on 18 qubits
  (tests/tn_vs_sv.rs);
- a 26-qubit, depth-20, 770-gate circuit runs in about 9 s at width 2, in
  double precision.

CLI: wai-quantum sv --file CIRCUIT.jsonl [--fuse --top --sample --expect
--json]; tn shares its circuit reader. Byte-identical natively and under
wasm32-wasip2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!147
No description provided.