Workbench
Edit an OpenQASM 3 circuit, see it drawn, simulate it, and optimize it. Everything shown here is computed by the same engine the CLI and MCP tools use, so the page cannot display a result the engine would not produce.
Circuit
Sign in to queue a circuit. A job belongs to an account, so its results and cancellation are scoped to you.
Diagram
- h on q[0]
- h on q[0]
- h on q[0]
- cx on q[0], q[1]
- h on q[0]
- cx on q[0], q[1]
- measure q[0] into c[0]
- measure q[1] into c[1]
- qubits
- 2
- clbits
- 2
- gate count
- 6
- two qubit gate count
- 2
- depth
- 7
- uses mid circuit measurement
- no
- uses classical control
- no
- uses reset
- no
Qubit states
This circuit measures its qubits, so it has no statevector to draw. Remove the measurements to inspect the state before collapse.
Timeline
- layers (depth)
- 7
- concurrent layers
- 1
- idle cells
- 1
Columns are layers, not source order: operations in the same column run at once. The column count is the circuit depth reported above, computed the same way. Dashed cells are qubits waiting while others work — where decoherence accumulates on hardware.
Correlations
Correlations need a statevector. This circuit measures, so its state collapses — run it without shots, or use the step-through panel to see the state before the first measurement.
Subcircuitsshow / hideRepeated blocks in the circuit, shown as units rather than flattened.
This circuit declares no custom gates, so there are no subcircuits to group. Writing gate Name a, b { … } and calling it will show the expansion here.
Step throughshow / hideThe state after each gate, one step at a time.
- just applied
- cx q[0], q[1]
- next
- — (end)
- matches full run
- yes
| basis state | amplitude | probability |
|---|---|---|
| |00⟩ | 0.5000 + 0.0000i | 0.2500 |
| |01⟩ | -0.5000 + 0.0000i | 0.2500 |
| |10⟩ | 0.5000 + 0.0000i | 0.2500 |
| |11⟩ | 0.5000 + 0.0000i | 0.2500 |
Stepping stops before operation 7 (measure q[0]). A measure collapses the state, so no single statevector describes what comes after -- showing one sampled branch would present it as the state rather than as one outcome.
Each step simulates the circuit prefix exactly, so this is the real intermediate state rather than an animation. Only basis states with non-zero weight are listed. Every step is a URL, so a particular step can be shared.
Q-sphere
This circuit measures its qubits, so it has no statevector to draw.
Conversion lossshow / hideWhat is dropped when this circuit is exported to another framework.
No conversion loss: the circuit round-tripped exactly.
Measurement results
| Outcome | Count | Probability | Relative frequency |
|---|---|---|---|
| 00 | 262 | 0.2559 | |
| 01 | 265 | 0.2588 | |
| 10 | 237 | 0.2314 | |
| 11 | 260 | 0.2539 |
Resource estimateshow / hideLogical counts, and what they become on a fault-tolerant machine.
NISQ resources
- logical qubits
- 2
- circuit depth
- 7
- gate count
- 6
- one qubit gate count
- 4
- two qubit gate count
- 2
- measurement count
- 2
- reset count
- 0
- swap count
- 0
- barrier count
- 0
- conditional count
- 0
Fault-tolerant counts
- t count
- 0
- clifford count
- 6
- toffoli count
- 0
- unsupported for ft count
- 0
Assumptions
- Estimator: ketqat-static v0.1.0
- Static count over the circuit as written. No synthesis, decomposition, or optimization is applied.
- Duration not estimated: the hardware snapshot does not characterize every gate used.
- Success probability not estimated: the hardware snapshot does not characterize every gate used.
- No hardware snapshot supplied, so duration and fidelity are not estimated.
Fault-tolerant physical cost
The distillation factory dominates this estimate.
- This algorithm consumes no magic states, so no factory is needed. A Clifford circuit needs no distillation at all.
- code distance
- 3
- algorithm qubits
- 36
- factory qubits
- 0
- total physical qubits
- 36
- factory share
- 0%
- distillation levels
- 2
- raw magic states
- 0
- magic states
- 0
- logical cycles
- 7
- runtime
- 0.0 ms
- logical error
- 4.2e-3 of 0.01
| physical error rate | code distance | algorithm qubits |
|---|---|---|
| 2.5e-4 | 3 | 36 |
| 5.0e-4 | 3 | 36 |
| 1.0e-3 | 3 | 36 |
| 2.0e-3 | 5 | 100 |
| 4.0e-3 | 9 | 324 |
| layout | logical qubits | algorithm qubits |
|---|---|---|
| Bare register | 2 | 36 |
| 2D lattice-surgery layout (QDK) | 9 | 162 |
The summary above uses the bare register. Magic-state factories are counted as states, not as a footprint, and on a T-heavy circuit a factory is the majority of a real machine — so neither figure here is a machine size.
| model | prefactor A | code distance | algorithm qubits |
|---|---|---|---|
| Fowler conventional(used above) | 0.03 | 3 | 36 |
| Gidney-Fowler (Qualtran) | 0.1 | 5 | 100 |
Choosing between two equally conventional constants changes the qubit count by 2.78× — the footprint grows as d², so one step of code distance is more than one step of cost.
What this estimate assumes, and what it leaves out
- Surface code under circuit-level depolarizing noise.
- Logical error model p_L = 0.03 (p/0.01)^((d+1)/2), fitted rather than derived.
- Magic states are counted, not costed: distillation factory footprint is not modelled.
- Routing and layout overhead beyond the per-logical-qubit patch is not modelled.
- Each Toffoli is charged 4 T gates.
- Physical error rate 0.001, error budget 0.01, cycle time 1000 ns, threshold 0.01.
- This is a model, not a measurement. No circuit here has run on hardware, and the prefactor and threshold are fitted constants from the literature.
Factory cost: what is arithmetic and what is a model
The split matters. The first group is checkable by hand from the 15-to-1 protocol; the second is an assumption about layout, like the logical-error formula above it.
- exact: 15-to-1 consumes 15 inputs per output and suppresses error as p -> 35 p^3.
- exact: 2 level(s) needed: 1.0e-3 -> 3.5e-8 -> 1.5e-21.
- exact: Raw states per usable output: 15^2 = 225.
- exact: Total raw states: 0 x 225 = 0.
- model: Footprint model: 15 logical patches per level at the factory distance, 2d^2 physical qubits per patch.
- model: This is a reading of the standard construction, NOT a measured or published figure -- treat it as a model, as with the surrounding logical-error formula.
- model: Factory and algorithm are charged separately; no sharing of routing space is assumed either way.
- model: Only the leading order of the 15-to-1 error polynomial is used.
- model: Distillation throughput is not modelled, so this is a space estimate rather than a space-time one.
Error mitigation, compared
| method | ⟨Z⟩ | uncertainty | amplification | cost | basis |
|---|---|---|---|---|---|
| None (raw) | -0.0254 | ±0.0312 | 1.00× | 1,024 shots | measured |
| Zero-noise extrapolation | -0.0473 | ±0.0361 | 2.28× | 12,000 shots | measured |
| Readout correction | -0.0264 | ±0.0325 | — | no extra shots | measured |
| Clifford data regression | 0.0000 | — | R² undefined | 52,000 shots | measured |
| Virtual distillation (modelled) | 0.0000 | — | 2 copies | 4 qubits, ×1.1 samples | modelled |
| Probabilistic error cancellation | not run | — | γ = 1.020 | 1.27e+3 shots for parity | computed |
Amplification is how much a method multiplies the statistical uncertainty. Extrapolation removes bias by taking a weighted difference, and the same weights inflate variance — so a mitigated value can be closer to noiseless and less well resolved at the same time. PEC is costed, not run: γ is the quasi-probability norm, and the shot figure is what matching the raw estimator’s precision would take. The basis column says where each number comes from: measured rows consume sampled counts, computed rows are arithmetic on the noise model, and the modelled row applies its method to the ideal state degraded by the assumed noise rather than to a sampled one.
Extrapolation data points
| noise scale | ⟨Z⟩ | shots |
|---|---|---|
| 1× | -0.0250 | 4,000 |
| 3× | -0.0030 | 4,000 |
| 5× | -0.0110 | 4,000 |
The fit is re-derivable from these points, so the mitigated value above can be checked rather than taken on trust.
- noisy locations
- 6
- 1-qubit error
- 0.10%
- 2-qubit error
- 1.00%
- readout error
- 2.00%
Clifford data regression has caveats here.
- This circuit is already Clifford, so every training variant is identical to it and the regression has nothing to learn. Its exact value is directly computable -- mitigation is unnecessary here.
- Every training circuit had the same exact value, so the regression is vacuous: it predicts that constant for any input and its slope carries no information. R^2 is reported as NaN rather than 1, because a perfect-looking fit here would be misleading. Pick an observable the Clifford substitutions actually change.
Virtual distillation has a floor here.
- Mitigation made this worse: error rose from 0.0000 to 0.0000. Distilling toward the wrong state moves the estimate away from the ideal one, which is possible whenever the noise is not purely stochastic.
Assumptions and limits
- Error rates are assumed, not measured. The hardware profiles in this app carry topology and native gates but no calibration data, so none of these figures describes a real device.
- Virtual distillation is modelled, not measured: it needs a density matrix, so the ideal state is degraded by the assumed noise rather than sampled. The other rows consume real counts.
- Single-qubit depolarizing noise, inverted exactly as a Pauli quasi-probability.
- Every noisy location is assumed independent and identically distributed.
- Overhead is gamma^(2 x locations), so it compounds exponentially in circuit size.
- Cost is computed, not incurred: this reports what PEC would take, it does not sample.
- Noise scales approximately linearly with circuit depth under global unitary folding.
- Extrapolation model: richardson.
- Trajectory sampling gives shot-noise-limited estimates; reported uncertainty is statistical only.
- The mitigated value is a model-dependent estimate, not a measurement.
- The map from noisy to exact expectation is linear, and the same for training and target.
- Training targets are exact statevector values, so they carry no shot noise.
- Training variants are the target circuit with non-Clifford gates snapped to nearest Clifford.
- Requires classically computable training values, which bounds circuit size.
- Expectation is Tr[O rho^M] / Tr[rho^M], the M-copy virtual-distillation estimator.
- Converges to the dominant eigenvector of the NOISY state, which is not the ideal state.
- Stochastic error is suppressed; a coherent error is not, at any M.
- Cost is M copies of the register plus a sampling overhead of 1 / Tr[rho^M].
Canonical OpenQASM 3show / hideThe circuit as this engine re-emits it, for comparing against your source.
OPENQASM 3; include "stdgates.inc"; qubit[2] q; bit[2] c; h q[0]; h q[0]; h q[0]; cx q[0], q[1]; h q[0]; cx q[0], q[1]; c[0] = measure q[0]; c[1] = measure q[1];