QuantumCompiler-Lab: teaching transpiler - passes, Euler + Toffoli decomposition, routing. Sim only!
105
Quantum Circuit Compiler / Transpiler Lab — by Darion Kellar
Educational quantum circuit compiler in ONE pure-Python file: a tiny circuit IR (H, X, Y, Z, S, T, RX/RY/RZ, CNOT, CZ, SWAP, Toffoli), conservative compiler passes written from scratch (gate cancellation, rotation merging, commutation-based reordering from an explicit safe table), decompositions (any 2x2 unitary to RZ-RY-RZ Euler form with asserted reconstruction; Toffoli to the standard 6-CNOT form), qubit mapping/routing on line and ring coupling graphs with SWAP overhead counted, before/after metrics for every pass, and an exact statevector simulator (≤ 6 qubits, hand-written complex matrix ops) that proves the optimized circuit equals the original on every basis input.
Pure Python standard library. Zero dependencies. Zero network. Honest scope: this is a teaching transpiler on toy circuits — it is not Qiskit, targets no hardware, submits nothing anywhere, and models no calibration, crosstalk, or device noise. Simulated equivalence is exact for these toy circuits (demo max deviation ~2e-16); it is not a hardware fidelity claim. Every real-hardware / production / advantage claim is a permanent HOLD gate (14 total).
docker pull credkellar/quantumcompiler-lab:latest
docker run --rm credkellar/quantumcompiler-lab:latest
The default command runs the full demo plus the built-in self-checks (CHECKS 55/55).
Run a specific command instead:
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py checks # CHECKS 55/55
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py passes # per-pass metrics, demo circuit
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py decompose # Euler + Toffoli decomposition
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py route # line vs ring SWAP routing
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py equiv # all-basis equivalence bundle
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py classify # kNN circuit-cost classifier
docker run --rm credkellar/quantumcompiler-lab:latest python3 main.py holds # 14 HOLD gates
python:3.12-slimScience · Developer tools · Machine learning & AI
credkellar/quantumcompiler-lab:latestdocker pull credkellar/quantumcompiler-lab:latest