7
$\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
    $\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$ – Nelimee Aug 7 '18 at 12:47
  • $\begingroup$ thank you sir, that is my question the distance-calc algorithm needs, the initialization of two registers which will have different number of qubits, then it sends to the swap-test function (which is inner-product) and i want to test it on the paper that is my problem?? $\endgroup$ – Aman Aug 7 '18 at 12:50
  • $\begingroup$ i mean i want to calculate by my hand and then i got this thing. i tried to insert identity, but wrong answer is what i got. $\endgroup$ – Aman Aug 7 '18 at 12:52
  • 1
    $\begingroup$ Are you saying that you've tried to work through the maths of the swap-test, and you can't get it working? In which case, please show us the circuit you're working through, and the calculation you've done. $\endgroup$ – DaftWullie Aug 7 '18 at 13:27
  • 1
    $\begingroup$ please write the calculations in the post using mathjax, instead of using a photo $\endgroup$ – glS Aug 7 '18 at 14:50
5
$\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$
  • $\begingroup$ once again sir, what do you mean padding every thing? how can i interpret this in quantum circuit form ?? $\endgroup$ – Aman Aug 12 '18 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 '18 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 at 13:25
3
$\begingroup$

Actually, there should be a minus. There is a mistake in the paper. Wittek uses a minus in his (expensive) book [https://www.amazon.com/Quantum-Machine-Learning-Computing-Mining/dp/0128100400/ref=sr_1_3?ie=UTF8&qid=1533850923&sr=8-3&keywords=quantum+machine+learning]

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$
  • $\begingroup$ Thank you sir, but in |ψ⟩ do we have 3 qubits or 2 qubits ? $\endgroup$ – Aman Aug 10 '18 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 '18 at 14:13
  • $\begingroup$ excuse me sir, how can i swap two registers which contains different number of qubits ?? thanks in advance. $\endgroup$ – Aman Aug 10 '18 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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