HomeQuantum ComputingQuantum Swap Test: State Overlap Estimator

Quantum Swap Test: State Overlap Estimator

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, fire batches of shots, and watch the measured statistics converge onto the true fidelity.

Quantum Computing3DAdvanced60 FPS📱 Mobile-adapted⇄ 2D version
quantum-machine-learning-computer-science ↗ Open standalone

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 simulator renders three qubits in 3D: two data registers, A and B, each an independently controllable point on its own Bloch sphere, and a third ancilla qubit wired through a Hadamard–controlled-SWAP–Hadamard circuit. Firing a batch of shots samples real Born-rule outcomes from the true fidelity between the two states, 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.

⚙ Under the hood

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.

Quantum Machine LearningSwap TestQubit FidelityBloch SphereQuantum KernelThree.js

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)