- engine::estimate::count: a program written in Clifford gates, T, z rotations, Toffolis (one CCZ state each) and measurements; a gate under several controls goes through clean ancillas (x, y, z, h under c >= 3 controls: 2c - 3 Toffolis and c - 2 ancillas; a phase under c >= 2: 2c Toffolis and c ancillas); a branching program is counted step by step, an upper bound. Each rotation is synthesised at its own angle within its share of the budget's synthesis share, its T count the word's. Counts: T, Toffolis, rotations and their T, measurements, non-Clifford, rotation and T depth, total depth, logical qubits with ancillas. - Ground truth: Bell, T chains, the ripple-carry adder (2n Toffolis), the QFT (3(n-1) T, 3(n-1)(n-2)/2 rotations), multi-controlled gates; every ladder held to the gate it replaces on dense unitaries with the ancillas at |0>; each rotation's T count equal to engine::synth's word. - engine::estimate::calibration: the gate-based surface code's model P(d) = a(p/p*)^((d+1)/2) fitted to the memory experiment decoded by exact matching and by union-find on the same shots (d 3, 5, 7; p 0.002 to 0.005; 100000 shots, 25000 at d = 7; seed 1). The table is in the crate; a release test measures every point again, a debug one one point, and the example estimate_calibration prints them. - engine::estimate::interchange: the logical-counts document and the routine document (v1), import and export, with the schema's checks (names, directions, resource types and values, unique siblings, connections between ports) and a self-made fixture. - engine::estimate: the planar model on the counts, the headline and the frontier no estimate beats on both qubits and runtime, each estimate sealed in the resource-estimate receipt family (a counted program binding the digest, every count, the budget, the synthesis share and each rotation's), the frontier's naming the headline's as parent, and the answer sealed in a job's form; verify re-runs the request. Refusals carry codes QE02 to QE08. - The engine feature now carries the resource model and the decoders' memory experiment; the receipt family compiles with the resource model and any signing feature. - CI: wai-quantum-estimate.yml runs the tests in release (the whole calibration); engine::estimate joins the wasip2 module list (18 passed under wasmtime on the build host). Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
1.5 KiB
Rust
31 lines
1.5 KiB
Rust
//! Measure again the decoder points the resource estimate calibrates its
|
|
//! code model from (`engine::estimate::calibration::POINTS`): the rotated
|
|
//! surface-code memory experiment, `d` rounds, every noise knob at `p`,
|
|
//! sampled once per point and decoded by exact matching and by union-find on
|
|
//! the same shots. Prints each point in the table's form.
|
|
//!
|
|
//! ```text
|
|
//! cargo run --release --example estimate_calibration --features full
|
|
//! ```
|
|
use wai_quantum::engine::estimate::calibration::{POINTS, SEED};
|
|
use wai_quantum::quantum_frame::{error_model, parse, sample, surface_code_memory};
|
|
use wai_quantum::quantum_match::MatchingGraph;
|
|
use wai_quantum::quantum_uf::UnionFind;
|
|
|
|
fn main() {
|
|
let mut same = true;
|
|
for q in &POINTS {
|
|
let c = parse(&surface_code_memory(q.distance, q.distance, q.p)).expect("the generated circuit parses");
|
|
let g = MatchingGraph::from_model(&error_model(&c).expect("deterministic")).expect("graphlike");
|
|
let s = sample(&c, q.shots as usize, SEED);
|
|
let exact = g.failures(&s).expect("decode");
|
|
let uf = UnionFind::new(&g).failures(&s).expect("decode");
|
|
let mark = if (exact, uf) == (q.exact, q.union_find) { "" } else { " // differs from the table" };
|
|
same &= mark.is_empty();
|
|
println!(" pt({}, {}, {}, {exact}, {uf}),{mark}", q.distance, q.p, q.shots);
|
|
}
|
|
println!("{}", if same { "every point is the table's" } else { "a point differs from the table" });
|
|
if !same {
|
|
std::process::exit(1);
|
|
}
|
|
}
|