I have a qubit state $|\psi\rangle = a|0\rangle + b|1\rangle$, and another qubit state $|\psi'\rangle = a'|0\rangle + b'| 1 \rangle$. I want, through quantum gates, to measure the overlap $|\langle \psi | \psi'\rangle|^2$ which is given by a projective measurement $\text{tr}\left[|\psi\rangle\langle \psi||\psi'\rangle\langle\psi'|\right]$. I want to know how to implement this measurement using quantum gates. Also, how would one generalise the measurement to a multi qubit state?
-
$\begingroup$ Quantum gates are necessarily reversible, and measurements are not - so this would not be possible. $\endgroup$– Mahathi VempatiMar 23, 2020 at 12:37
-
1$\begingroup$ @MahathiVempati what I mean is how to introduce ancillary qubits or how to control the two qubit states to produce a new state that can be measured, and from which the overlap $|aa'+bb'|^2$ can be deduced. $\endgroup$– Vladimir VargasMar 23, 2020 at 14:08
1 Answer
You are looking for the SWAP test.
The basic idea is the following: First, the overlap $\omega=\mathrm{tr}[\rho\sigma]$ of two quantum states (e.g. the pure states in your question) is equal to $$ \omega=\mathrm{tr}[(\rho\otimes\sigma)\mathbb F]\ , $$ with $\mathbb F$ the SWAP gate.
On the other hand, the expectation value of any unitary gate $U$ in a state $\rho$, $\mathrm{tr}[\rho U]$, can be estimated using phase estimation. The simplest version is to apply a controlled-U gate, where the control qubit is initialized in $|+\rangle$ and subsequently measured in the $|\pm\rangle$ basis. It is an easy exercise to see that the probabilities of the two measurement outcomes are directly related to $\omega$.
-
$\begingroup$ Thanks Norbert, I searched on the Internet the generalised SWAP test and found figure 9 of this paper: arxiv.org/pdf/1303.6814.pdf. I leave it for someone that could have the same question as me in the future $\endgroup$ Mar 23, 2020 at 18:01
-
$\begingroup$ I confirm that Garcia and Chamorro is the paper that describe the best swap test. However keep in mind that there are some limitations to Swap test especially error : I suggest reading also this paper in details iopscience.iop.org/article/10.1088/2058-9565/abe458/pdf $\endgroup$– guignolJul 24, 2021 at 20:04