Multi-state Swap Test Algorithm
Estimating the overlap between two states is an important task with several applications in quantum information. However, the typical swap test circuit can only measure a sole pair of quantum states at a time. In this study we designed a recursive quantum circuit to measure overlaps of multiple quantum states $|ϕ_1...ϕ_n\rangle$ concurrently with $O(n\log n)$ controlled-swap (CSWAP) gates and $O(\log n)$ ancillary qubits. This circuit enables us to get all pairwise overlaps among input quantum states $|\langleϕ_i|ϕ_j\rangle|^2$. Compared with existing schemes for measuring the overlap of multiple quantum states, our scheme provides higher precision and less consumption of ancillary qubits. In addition, we performed simulation experiments on IBM quantum cloud platform to verify the superiority of the scheme.