circuits / swap-test
SWAP Test
✓FEATUREDDetermines the overlap between two quantum states without measuring them. Ancilla qubit reads |0⟩ if states are identical.
openqasm3q3 gatesdepth 30 views0 saves0 forks0 downloads
Source Code
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[1];
h q[0];
cswap q[0],q[1],q[2];
h q[0];
measure q[0] -> c[0];Cite this circuit
MITquantumcomputer.dev. "SWAP Test". quantumcomputer.dev/circuits/swap-test. 2026.