wai-quantum-service: the cutrank method, exact samples of a Clifford circuit measured in a product basis #342

Merged
dcharlot merged 1 commit from wai/quantum-service-cutrank-pr into main 2026-10-19 21:23:11 -04:00
Owner

The service gains the cutrank method, built on wai-quantum 0.6.6's quantum_cutrank (#340). It gives exact samples, and amplitudes, of a Clifford circuit followed on each qubit by one-qubit gates at any angles. The cost is set by the state's cut-rank along an order of the qubits, not by how many qubits there are.

What it takes and answers

  • qasm::Program::product_measured splits the program in two. The Clifford part is lowered gate by gate. Each qubit's gates, from its first non-Clifford one on, are multiplied into one matrix. A gate on several qubits that comes after such a gate is refused, and its refusal names the gate and the qubit.
  • The planner (catalog::product_measured):
    • takes the graph form and searches orders for narrower cuts, with a move budget of about a second;
    • admits the job by its largest table, in double precision when that fits the job's memory and single otherwise;
    • caps the table entries its passes touch at 4e12, about ten minutes.
    • The run rebuilds the same order.
  • Counts are exact samples, seeded.
  • Amplitudes are exact up to one phase that all of the job's amplitudes share, since a stabilizer tableau does not fix a state's global phase. The result's global_phase member says so, and accuracy.max_cut gives the widest cut.
  • Expectation values are refused.
  • auto tries cutrank for counts after the state vectors and before mps. For amplitudes it stays explicit, so the methods that fix the phase keep their place.

Evidence

  • Tests:
    • amplitudes equal the state vector's times one phase (6, 9 and 11 qubits, 24 amplitudes each);
    • counts follow the exact distribution over 40,000 shots and repeat with their seed;
    • auto samples a 40-qubit ring with chords by cutrank;
    • the refusals name the gate.
  • Mutants caught: the tail multiplied in the wrong order, and samples mapped to the wrong qubits.
  • smoke.sh samples a 60-qubit instance (max cut 10 bits).
  • The README gets a table row and a bullet on how it runs, and the method enums in discovery and MCP list it.
  • Checked on the build host: cargo test --locked --release (64 passed), clippy with -D warnings, and the full smoke.sh against a local server.

🤖 Generated with Claude Code

The service gains the **`cutrank` method**, built on wai-quantum 0.6.6's `quantum_cutrank` (#340). It gives exact samples, and amplitudes, of a Clifford circuit followed on each qubit by one-qubit gates at any angles. The cost is set by the state's cut-rank along an order of the qubits, not by how many qubits there are. ### What it takes and answers - **`qasm::Program::product_measured`** splits the program in two. The Clifford part is lowered gate by gate. Each qubit's gates, from its first non-Clifford one on, are multiplied into one matrix. A gate on several qubits that comes after such a gate is refused, and its refusal names the gate and the qubit. - **The planner** (`catalog::product_measured`): - takes the graph form and searches orders for narrower cuts, with a move budget of about a second; - admits the job by its largest table, in double precision when that fits the job's memory and single otherwise; - caps the table entries its passes touch at 4e12, about ten minutes. - The run rebuilds the same order. - **Counts** are exact samples, seeded. - **Amplitudes** are exact up to one phase that all of the job's amplitudes share, since a stabilizer tableau does not fix a state's global phase. The result's `global_phase` member says so, and `accuracy.max_cut` gives the widest cut. - **Expectation values** are refused. - **`auto`** tries `cutrank` for counts after the state vectors and before `mps`. For amplitudes it stays explicit, so the methods that fix the phase keep their place. ### Evidence - **Tests:** - amplitudes equal the state vector's times one phase (6, 9 and 11 qubits, 24 amplitudes each); - counts follow the exact distribution over 40,000 shots and repeat with their seed; - `auto` samples a 40-qubit ring with chords by `cutrank`; - the refusals name the gate. - **Mutants caught:** the tail multiplied in the wrong order, and samples mapped to the wrong qubits. - **`smoke.sh`** samples a 60-qubit instance (max cut 10 bits). - **The README** gets a table row and a bullet on how it runs, and the method enums in discovery and MCP list it. - **Checked on the build host:** `cargo test --locked --release` (64 passed), clippy with `-D warnings`, and the full `smoke.sh` against a local server. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wai-quantum-service: the cutrank method, exact samples of a Clifford circuit measured in a product basis
All checks were successful
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 1m26s
wai-quantum service / does this change touch it (pull_request) Successful in 31s
wai-quantum service / service · linux (pull_request) Successful in 49s
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 4m2s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 9m51s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m16s
wai-quantum service / service · macos (pull_request) Successful in 47s
855822e2d7
A Clifford circuit followed, on each qubit, by one-qubit gates at any angles
(qasm::Program::product_measured splits it: each qubit's gates from its first
non-Clifford one on, multiplied into one matrix; a gate on several qubits
after that is refused). The planner takes the graph form, searches orders for
narrower cuts with a move budget of about a second, and admits the job by its
largest table (double precision when it fits, single otherwise) and by the
entries its passes touch. The run rebuilds the same order.

Answers: counts, exact samples; amplitudes, exact up to one phase shared by
the job's amplitudes, which the result's global_phase says (a tableau does not
fix a state's global phase). Expectation values are refused. auto tries it for
counts after the state vectors and before mps.

Tests: amplitudes equal the state vector's times one phase (6, 9 and 11
qubits, 24 amplitudes each); counts follow the exact distribution (40 000
shots) and repeat with their seed; auto samples a 40-qubit ring with chords by
cutrank; refusals name the gate. Mutants caught: the tail multiplied in the
wrong order, samples mapped to the wrong qubits. smoke.sh samples a 60-qubit
instance (max cut 10 bits).

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!342
No description provided.