14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher Quantum Computing - Grover’s Algorithm Programming Quantum Computers: A Primer with IBM Q and D-Wave Exercises Patrick Dreher NC State University Chief Scientist - NCSU IBM Q Hub 1
27
Embed
Quantum Computing - Grover’s Algorithmmueller/qc/qc-tut/ASPLOS19-Grover.pdf14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher. Grover Algorithm •
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Grover Algorithm
• Define Grover operator G and initial uniform superposition of states and O
• The amplitude of each state is flipped about the mean
• Applying makes |x*> have amplitude above the mean while all other states have an amplitude below the mean
5
|𝛹𝛹 >
]𝐺𝐺 = [2|𝛹𝛹 >< 𝛹𝛹| − 𝐼𝐼
𝐺𝐺 = [2|𝛹𝛹 >< 𝛹𝛹| − 𝐼𝐼]�𝑖𝑖
𝑎𝑎𝑖𝑖 |𝑖𝑖 >= �𝑖𝑖
�2 < 𝑎𝑎 > −𝑎𝑎𝑖𝑖]|𝑖𝑖 >
]𝐺𝐺 = [2|𝛹𝛹 >< 𝛹𝛹| − 𝐼𝐼
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Implementation of the Algorithm1. Use the Quirk simulator (https://algassert.com/quirk )2. Initialization
• Initialize the qubits in a superposition with N-1/2 normalization (.25 for N=4)
3. Oracle• Implement the Oracle function
4. Amplification • Phase flip the amplitude about the average amplitude• Inverting the target state amplitude while keeping all other amplitudes unchanged
causes the target amplitude to increase while all other states decrease
5. Measurement• Perform a readout of the final qubit states
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Initialization of 4 Qubit System• Quantum computing platforms are normally initialized as
• The procedure is to apply Hadamard gates to each qubit
|q0> |q1>|q2>|q3>
7
|𝟎𝟎 >= 𝟏𝟏𝟎𝟎
HHHH
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Possible Oracle Configurations with 4 Qubits• With 4 qubits there are 16 possible oracle configurations
• States are initialized on QC platforms in the state
• Recall that the Z gate has the matrix representation
• Recall that the T gate has the matrix representation
8
|𝟎𝟎 >= 𝟏𝟏𝟎𝟎
𝟏𝟏 𝟎𝟎𝟎𝟎 −𝟏𝟏
𝟏𝟏 𝟎𝟎𝟎𝟎 𝒆𝒆𝒊𝒊
𝝅𝝅𝟒𝟒
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher 9
X
X
X
Z
X
X
X
X
X
Z
X
X
X
X
Z
X
XX
Z
X
0000
0010
0001
0011
XX X X
XX X X
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher 10
X
X
XZ
X
X
X
X
XZ
X
XX
XZ
X
X
XZ
X
0100
0110
0101
0111
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher 11
X
X
X
Z
X
X
X
X
X
Z
X
X
X
X
Z
X
XX
Z
X
1000
1010
1001
1011
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher 12
X
X
Z
X
X
X
Z
X
X
Z
X
1100
1110
1101
1111Z
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Reference The Toffoli Gate Construction
• The Toffoli gate is a 3-bit gate, which is universal for classical computation• If the first two bits are in the state |1>, it applies a Pauli-X (NOT) on the
third bit, otherwise the state is left unchanged
13
|c>
|b> |b>
|c ab>⊕
|a> |a>
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher
Properties of Toffoli Gates• Toffoli Gate is a reversible gate (i.e. UT
-1UT=I) or • Toffoli gate is used to replace a classical circuit with the equivalent
reversible gate• Two bits are control bits (|a> and |b>) and target bit |c> is flipped as
per the truth table(a, b, c) (a, b, c ab) (a, b, c)
• Toffoli gate and be used to simulate a NAND Gate
14
⊕
|1>
|b> |b>
|1 ab> = |ab>⊕
|a> |a>
¬
¬
14-April-2019 Introduction to Quantum Computing - ASPLOS Tutorial Patrick Dreher