代写代考 MULT20015 Prac Class 8.docx

Microsoft Word – MULT20015 Prac Class 8.docx

MULT20015 Practice Class 8, Ó L. Hollenberg et al 2021 1

Copyright By PowCoder代写 加微信 powcoder

MULT20015 Elements of Quantum Computing

Practice Class 8

Welcome to Practice Class 8 of MULT20015 Elements of Quantum Computing.

The purpose of this lab session is to:
• understand the underpinning concepts of quantum search
• implement oracle functions, inversion and inversion-about-the-mean
• implement Grover’s algorithm for single solution case

1 Removing a Qubit from Grover’s algorithm

In the lecture on Grover’s algorithm we saw that it was possible to remove the second
register, which consists of a single qubit in the |−⟩ state. In this exercise we will go through
the same steps using the QUI.

Exercise 1.1 Using QUI, code up the following circuit:

Observing the output, show that the amplitudes beginning with “10” are the negative of
the corresponding amplitudes for other states.

Exercise 1.2 Using the QUI, code up the following circuit, with a CZ gate replacing the
Toffoli gate of the previous exercise.

Compare the output, and show that they are identical to the previous exercise.

From now on, we will use control-Z gates, and remove the second register.

Exercise 1.3 (a) Remove the final qubit, and show that the following sequence applies a
phase to the |10⟩ state.

MULT20015 Practice Class 8, Ó L. Hollenberg et al 2021 2

(b) Construct three similar sequences which apply phases the |00⟩, |01⟩, and |11⟩ states.

2 Marking states with an oracle

Exercise 2.1 a) Consider the oracle function below. Verify that it marks one state in the
equal superposition. What is the corresponding binary number marked?

b) Build and run a circuit to implement an oracle function that will mark the number 13
(Most Significant Bit (MSB) at the top, i.e. 13 = 01101).

3 Inversion

Exercise 3.1 a) Show that the following (3-bit) circuit implements the “inversion” operation,
giving a minus sign to the zero state, but leaving all other states are unchanged.

b) Generalise to the 5 bit case and test.

4 Inversion about the mean

Exercise 4.1 Show that the following circuit implements the “inversion about the mean”
operation for 3 qubits and fill in the state amplitudes and phases in the plots provided.
Check that the output state has the amplitudes reflected about the average.

MULT20015 Practice Class 8, Ó L. Hollenberg et al 2021 3

5 Grover search – single solution case

Now we’ll put all that together to implement simple instances of Grover’s search algorithm.

Exercise 5.1 Program a circuit in the QUI that implements Grover’s search (at least 8
iterations) for the number 5 over a data base of 3-bit numbers represented in an equal
superposition. Run the time slider through the circuit to see what’s happening with the
states and entanglement.

From lectures we saw the geometric picture of Grover’s algorithm as a series of rotations
towards the search state(s).

Exercise 5.2 For the example in 5.1 (one solution, i.e. M=1) compute the Grover angle q
and fill in the table below to verify the geometric picture c.f. QUI outputs (a j is the
amplitude of the search state |101>).

Iteration,

Inspect in QUI Geometric Picture
a j |a j|2 (2𝑗 + 1)𝜃

𝛼! = sin((2𝑗 + 1)𝜃) |𝛼!|” = [sin((2𝑗 + 1)𝜃)]”

0 0.354 0.125 0.3614 0.3536 0.1250
1 0.884 0.781 1.0842 0.8839 0.7813

|𝜓#⟩ = 𝛼#|𝑎⟩ + 𝛽#|𝑏⟩
|𝜓$⟩ = 𝛼$|𝑎⟩ + 𝛽$|𝑏⟩
|𝜓”⟩ = 𝛼”|𝑎⟩ + 𝛽”|𝑏⟩

8𝜓!9 = 𝛼!|𝑎⟩ + 𝛽!|𝑏⟩
𝛼! = sin ((2𝑗 + 1)𝜃)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com