MEDUSA, running in your browser
MEDUSA keeps a quantum state as a multi-terminal binary decision diagram and, for circuits with loops, computes a symbolic summary of the loop body once instead of executing every iteration. Every number on this page is measured live on your device by the simulator's own C code compiled to WebAssembly.
Loop summarization against plain execution
Grover's search repeats one loop body, the oracle followed by the diffusion operator, about 2n/2 times. Both lanes simulate the same OpenQASM file from the MEDUSA benchmark set. The only difference is the --symbolic flag.
With loop summarization
Without: every iteration executed
Simulation time against circuit size, measured on this device
Show the measurements as a table
What the summary does
- Abstract. Each distinct amplitude in the state entering the loop is replaced by a symbolic variable. Grover's state has only a handful.
- Run the body symbolically. The gates are applied once, and the leaves of the MTBDD become terms over those variables.
- Refine to a fixpoint. If two basis states sharing a variable are updated differently, the variable is split and the body is run again.
- Evaluate. The resulting update map is applied for all K iterations on a few numbers, with no further gate operations.
Loop-free circuits: the simulator itself is fast
These circuits from the repository's benchmark set have no loops, so summarization plays no part. Gates are applied directly on the decision diagram, whose size follows the structure of the state and not 2n.
| Circuit | Qubits | Gates | Time | MTBDD nodes | Wasm memory | Dense vector would hold |
|---|
Wasm memory is the whole linear memory of the instance at exit, including an 8 MiB stack reservation. The last column is context only: a dense state vector stores one complex amplitude per basis state.
Playground
Edit the circuit or pick an example. Supported gates: x y z h s t tdg, rx ry rz (float64 only), cx cz ccx mcx, one for loop level, and measure.