10
$\begingroup$

I found an algorithm that can compute the distance of two quantum states. It is based on a subroutine known as swap test (a fidelity estimator or inner product of two state, btw I don't understand what fidelity mean).

My question is about inner product. How can I calculate the inner product of two quantum registers which contains different number of qubits?

The description of the algorithm is found in this paper. Based on the 3rd step that appear on the image, I want to prove it by giving an example.

Let: $|a| = 5$, $|b| = 5 $, and $ Z = 50 $ $$|a\rangle = \frac{3}{5}|0\rangle + \frac{4}{5}|1\rangle$$ $$|b\rangle = \frac{4}{5}|0\rangle + \frac{3}{5}|1\rangle $$ All we want is the fidelity of the following two states $|\psi\rangle$ and $|\phi\rangle$ and to calculate the distance between $|a\rangle$ and $|b\rangle$is given as: $ {|a-b|}^2 = 2Z|\langle\phi|\psi\rangle|^2$ so $$|\psi\rangle = \frac{3}{5\sqrt{2}}|00\rangle + \frac{4}{5\sqrt{2}}|01\rangle+ + \frac{4}{5\sqrt{2}}|10\rangle + + \frac{3}{5\sqrt{2}}|11\rangle$$ $$|\phi\rangle = \frac{5}{\sqrt{50}} (|0\rangle + |1\rangle) $$ then how to compute $$\langle\phi|\psi\rangle = ??$$

$\endgroup$
1
  • 1
    $\begingroup$ In a few words, you can't. The inner product is defined for 2 vectors of the same space (i.e. 2 vectors of the same dimension) whereas your vectors (or quantum states) don't have the same size. $\endgroup$ Aug 7, 2018 at 12:47

2 Answers 2

7
$\begingroup$

I guess you're looking at equations (130) and (131)? So, here, you have $|\psi\rangle=(|0\rangle|a\rangle+|1\rangle|b\rangle)/\sqrt{2}$ and $|\phi\rangle=|a| |0\rangle+|b| |1\rangle$. When it says to calculate $\langle\phi|\psi\rangle$, what it really means is $$ (\langle\phi|\otimes\mathbb{I})|\psi\rangle, $$ padding everything with identity matrices to make them all the same size. Thus, the calculation becomes $$ \frac{1}{\sqrt{2Z}}\left(\begin{array}{cccc} |a| & 0 & |b| & 0 \\ 0 & |a| & 0 & |b| \end{array}\right)\cdot\left(\begin{array}{c} a_0 \\ a_1 \\ b_0 \\ b_1 \end{array}\right), $$ where $a_0$ and $a_1$ are the elements of your vector $|a\rangle$. If you work this through, you'll get $$ \frac{1}{\sqrt{2Z}}(|a| |a\rangle+|b| |b\rangle). $$ I have no idea where the negative sign has come from in equation (133).

$\endgroup$
3
  • $\begingroup$ once again sir, what do you mean padding every thing? how can i interpret this in quantum circuit form ?? $\endgroup$
    – Aman
    Aug 12, 2018 at 11:10
  • $\begingroup$ @Aman I mean that when two operators (or states, in this case) are defined for different sets of qubits, then way that you make them the same size is that you insert a tensor product with the 2x2 identity matrix for every qubit that is not in the given set. $\endgroup$
    – DaftWullie
    Aug 13, 2018 at 6:29
  • $\begingroup$ @Aman: You can only swap qubit registers. What is happening is that you swap the first register with the first qubit of the second register. This leaves the question of what to do with the remaining qubit of the second register. You apply the identity operation to it, which explains where the identity above came from. $\endgroup$
    – Peter Shor
    Mar 17, 2019 at 13:25
6
$\begingroup$

Actually, there should be a minus. There is a mistake in the paper. Wittek uses a minus in his (expensive) book.

Indeed say : $$ |\psi\rangle = \frac{1}{\sqrt{2}} (|0,a\rangle + |1,b\rangle) $$ $$ |\phi\rangle = \frac{1}{\sqrt{Z}} (|a||0\rangle - |b||1\rangle) $$

Then : $$ \langle \phi |\psi\rangle = \frac{1}{\sqrt{2Z}} (|a|\langle 0| - |b|\langle 1|) (|0,a\rangle + |1,b\rangle) $$ $$ = \frac{1}{\sqrt{2Z}}( |a|\langle 0|0\rangle|a\rangle - |b|\langle 1|0 \rangle|a\rangle + |a|\langle 0|1 \rangle|b\rangle - |b|\langle 1| 1 \rangle |b\rangle )$$

$$ = \frac{1}{\sqrt{2Z}} (|a| |a\rangle - 0 + 0 - |b| |b\rangle) = \frac{1}{\sqrt{2Z}} (|a| |a\rangle - |b| |b\rangle) $$

Now for the part of the question where you ask how to swap quantum registers of different numbers of qubits, the answer is you don't really do that. You actually swap the ancilla qubit of $|\psi\rangle $ with $ |\phi\rangle $. This is not told in the reference but it is said in the original reference it is based on.

$\endgroup$
2
  • $\begingroup$ Thank you sir, but in |ψ⟩ do we have 3 qubits or 2 qubits ? $\endgroup$
    – Aman
    Aug 10, 2018 at 13:58
  • $\begingroup$ You have the number of qubits necessary for a and b (say N) and you add another one so N+1. $\endgroup$
    – cnada
    Aug 10, 2018 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.