12

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 \begin{align*}|\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) \end{align*} then how to compute $\langle\phi|\psi\rangle = ??$

Frederik vom Ende
  • 4,163
  • 3
  • 12
  • 49
Aman
  • 473
  • 3
  • 13

2 Answers2

8

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).

DaftWullie
  • 62,671
  • 4
  • 55
  • 140
6

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.

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112
cnada
  • 4,802
  • 1
  • 9
  • 22