QPU
A quantum circuit simulator with its own assembly-style language, and a static React workbench that compiles those processes in the browser.
- 134
- Physics-engine tests, of 561 across the repository
- 6
- Kraus noise channels, plus T1/T2 decoherence and transmon leakage
- 17
- Qubits in the bundled four-bit full adder, built from nested child processes
- 4
- Layers: a language, a compiler, a physics engine, and a browser workbench
Language and compiler design
A custom quantum instruction language with its own TypeScript compiler, a physics engine that owns every state change — state vectors, density matrices, noise, and pulse-level timing — and a browser workbench that runs it all live.
Why it exists
QPU began as a small Python script written while preparing a presentation on quantum hardware fingerprinting, a topic explored in research on securing NISQ-era cloud quantum computing. Understanding how a quantum computer's own noise and gate errors could be used to identify it meant first understanding how a quantum instruction actually executes — which is what the script became: a compiler and simulator, later rebuilt as a browser workbench so a circuit could be written, compiled, and run without a local Python environment.
Run the workbench
The workbench is published from BPForbes.QPU.github.io and loads below as a guest window. It is the real build, not a recording. If it does not attach within twelve seconds the window says so and offers a reload.
Running it
The workbench compiles a QPU protocol into a circuit and hands every state change to its
physics engine. Below is the bundled Quantum teleportation circuit after
Run all: mid-circuit measurements drawn as meters, classical results on
double lines, and the two IF-conditioned corrections marked as taken.
0b0d607. Not a mockup: the canvas is the simulator's own run of the
repository's bundled teleportation example — a run in which both measurements
read 1, so both corrections fire.
The Physics inspector reruns the same circuit as an open system. Here the GHZ example runs with 2% depolarizing noise after every gate; stepping back to the third gate shows the noisy density matrix at 0.93 fidelity with the ideal run, and each qubit at purity 0.5 — maximally entangled with the other two.
0b0d607, cropped to the inspector's noise section. The values are the
engine's output for the repository's bundled GHZ example.
Read the technical write-up
What it is
BPForbes.QPU.github.io (June 2026, with a second wave from September 2026; originally BPForbes.github.io) is a TypeScript compiler for the QPU process language, a physics engine that owns every state change, and an interactive circuit canvas with file tools, truth-table I/O, and a correction lab.
What the commits added
Workbench, June 2026. Forty commits in four days. AST backend and
gate-placement validation; interactive workbench; hamburger navigation and
.qpucir persistence; progress visualization and PDF docs on Pages;
two-bit adder register/output-binding fixes; RESET hidden from UI; pi
rotations; Circuit Correction Lab (first WebLLM, then local Ollama); .qpuio
truth-table metadata; partial tables; per-file gate modules and a custom-gate engine.
Teaching lab and physics, September 2026. A compact embed mode for this
site; textbook circuits, Play Sequence, and mobile-safe playground routes; measurement
meters, classical double lines, and boxed CZ/CY; DECLARECHILD binding; a
beginner teaching layer with in-app gate help; purity, cycle, and gate concepts; and
finally PhysicsEngine as the single authoritative boundary — state vector
and density-matrix kernels, X/Y/Z measurement, Kraus noise and T1/T2 decoherence,
Hamiltonian evolution, calibrated drive pulses, and three-level leakage, all validated
and covered by their own test suite.
BPForbes.QPU.github.io on GitHub — the full commit history and source.