TransWikia.com

How to implement the exponential of an outer product?

Quantum Computing Asked on April 2, 2021

In exercise 6.7 page 258 in Nielsen and Chuang book, they have a Hamiltonian $H = left| x rightrangle !!leftlangle x right| + left| psi rightrangle !!leftlangle psi right|$ and the purpose is implementing $exp(-iHt)left| psi rightrangle$, where $left| psi rightrangle = frac{sum_{x}left| x rightrangle}{sqrt N}$.

Regarding the first part of the Hamiltonian, I couldn’t understand how I can figure out the circuit implementation (the gates) for the operator $exp(-i left| x rightrangle !!leftlangle x right| Delta t)$.

In the book, they implement it as:

enter image description here

Could you please explain to me that circuit, and how they come out with it?

And what the oracle contains? an example with 4-qubits ($exp(-i left| 0101 rightrangle leftlangle 0101 right| Delta t)$) or else, would be too helpful.

And thank you.

2 Answers

Firstly let's use Taylor series (I will write $t$ instead of $Delta t$):

begin{equation} e^{-i |x rangle langle x | t} = I + (-i |x rangle langle x | t) + frac{(-i |x rangle langle x | t)^2}{2!} + frac{(-i |x rangle langle x | t)^3}{3!} ... = = left( I + (-i t) + frac{(-i t)^2}{2!} + frac{(-i t)^3}{3!} ... right) |x rangle langle x | + I(1 - |x rangle langle x|) = = I + (e^{-it} - 1) |x rangle langle x | end{equation}

So the circuit should implement the operator $I + (e^{-it} - 1) |x rangle langle x |$.

Now what does the Oracle (from the M. Nielsen and I. Chuang textbook):

$$|xrangle |qrangle xrightarrow[]{text{O}} |xrangle |q oplus f(x)rangle$$

So, if $|qrangle = |0rangle$ as mentioned in the circuit, and note that $f(x) = 1$ only if $x$ is a solution, otherwise $f(x) = 0$. The operator that corresponds to the Oracle (here I am assuming (also assumed in the book) that we have only one solution):

$$O = sum_{y ne x} |yrangle langle y| I + |xrangle langle x| X = II + |xrangle langle x| (X - I) $$

Let's see what the combined action looks like (the phase gate is denoted as $P$ and $II equiv I$):

begin{equation} O : I cdot P : O = left[ I + |xrangle langle x| (X - I) right] I cdot P left[ I + |xrangle langle x| (X - I) right]= = I cdot P + |xrangle langle x| P(X - I) + |xrangle langle x| (X - I) P +|xrangle langle x| (X - I) P (X - I) = = I cdot P - |xrangle langle x| P + e^{it}|xrangle langle x| P^{dagger} end{equation}

because $XPX = e^{it}P^{dagger}$. Let's take into account that the ancillary qubit starts in the $|0 rangle$ state, then the combined operator will look like (by omitting the $P$ and $P^{dagger}$ applyied on the ancillary qubit, because they do noting on the $|0 rangle$ state and thus the ancillary qubit is "out of the game"):

begin{equation} I - |xrangle langle x| + e^{it}|xrangle langle x| = I + (e^{it} - I)|xrangle langle x| end{equation}

How one can see there is the inconsistency of $-$ sign in the phase like in this answer to the related question, because, maybe I did a mistake, or perhaps, there is a typo in the book. Now let's draw an example when $|xrangle = |0101rangle$ (I will show the simplest example: the implementations can be different depending on what we want to find with Grover, but one thing should be the same: in all cases $|0101rangle$ should be a solution):

                                                           

where the leftmost qubit in $|0101rangle$ corresponds to the first wire. The circuit is drawn with quirk. The way of implementing the Oracle shown above more explicitly can be understood from this answer about black and white dots in the circuit and this answer about multi-controlled gates.

Correct answer by Davit Khachatryan on April 2, 2021

When exponentiating a diagonal matrix, you get a new diagonal matrix where the diagonals are exponentiated.

If the matrix: $-i|xranglelangle x|Delta t$ = $textrm{diag}(0,iDelta t)$, the matrix exponential is $textrm{diag}(e^0,e^{iDelta t})$ as shown in the 2x2 gate in the figure you showed. You do not need "oracles" to do matrix exponentiation, and the fact that the ones in your diagram take several qubits as input, not just one, indicates to me that they have nothing to do with the matrix exponentiation but probably are related to some other part of the problem.

For your 4-qubit example, write down the diagonal matrix and then exponentiate the diagonals. You will get 15 elements being $e^0=1$, and you will get $e^{-iDelta t}$ for the other element, depending on how you define $|0101rangle$ (the way I have defined it, there is no negative sign, so that's why I have a negative sign in my exponential, while your diagram did not).

Answered by user1271772 on April 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP