Quantum Algorithms Database
SWAP Test
A simple but widely used quantum subroutine for estimating how similar two quantum states are, without fully measuring either one.
Year
2001 (Buhrman, Cleve, Watrous & de Wolf)
Inventor(s)
Buhrman, Cleve, Watrous & de Wolf
Speedup Type
No Speedup Claimed
Difficulty
★★★☆☆
The Problem
Determining how similar (or different) two quantum states are — a building block used inside many other quantum algorithms, especially in quantum machine learning.
How It Works
Uses an auxiliary qubit and a controlled-swap gate between the two states being compared; measuring the auxiliary qubit gives a probability directly related to the overlap between the two states.
Real-World Impact
A foundational subroutine used inside quantum machine learning algorithms (like quantum k-means and quantum SVMs) for similarity comparison, rather than a standalone application.