Quantum Swap Test: State Overlap Estimator (2D)
Interactive 2D statevector simulator of the quantum swap test — a genuine 3-qubit circuit (ancilla + register A + register B) simulated amplitude by amplitude through Hadamard, controlled-SWAP and Hadamard, then sampled shot by shot to show the measured overlap estimate converge onto the true fidelity |⟨ψ|φ⟩|².
Quantum machine learning algorithms need a way to measure "how similar" two data points are once they've been encoded as quantum states — that's exactly what the swap test provides. This 2D simulator builds the real joint statevector of three qubits — two data registers, A and B, each set from its own Bloch-circle angles, plus an ancilla qubit — and pushes it through an explicit Hadamard–controlled-SWAP–Hadamard circuit, amplitude by amplitude. Firing a batch of shots then samples real Born-rule outcomes from that simulated ancilla marginal, and the running measured statistics visibly converge toward the exact overlap as more shots accumulate — the same statistical process that underlies quantum k-means, quantum kNN and quantum kernel classifiers.
Interactive 3D simulator of the quantum swap test — the ancilla-qubit circuit that quantum machine learning algorithms (quantum k-means, quantum kernel/kNN) use to estimate the overlap between two quantum states without ever measuring them directly. Set two qubit states on their own Bloch spheres, fire batches of shots, and watch the measured statistics converge onto the true fidelity.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install