Title: Introduction to Quantum Computing Lecture 2: Quantum Algorithms
1Introduction to Quantum ComputingLecture 2
Quantum Algorithms
Rod Van Meter rdv_at_tera.ics.keio.ac.jp June
27-29WIDE University School of Internet with
numerous slides from E. Abe
2Course Outline
- Lecture 1 Introduction
- Lecture 2 Quantum Algorithms
- Lecture 3 Devices and Technologies
- Lecture 4 Quantum Computer Architecture
- Lecture 5 Quantum Networking Wrapup
3Outline
- Introduction
- Deutsch-Jozsa
- Grover's search algorithm
- Shor's factoring algorithm
- Brief look at Quantum Error Correction (QEC)
4How Do Quantum Algos Work?
- Runs are begun by creating a superposition of all
possible input values. - Executing a function gives a superposition of
answers of all possible inputs! The hard part is
extracting the answer we want. - Every part of the superposition works
independently on the algorithm. - They all work by using interference. The phase
of parts of the superposition are arranged to
cancel out and leave only the interesting answer.
5Quantum Parallelism
0
1
0
1
0
1
0
0
0
Apply Hadamards to n-qubit register
2
2
2
1
Ä
n
0
00
0
01
1
11
0
n
2
2
N
1
1
1
N
x
0
1
2
1
n
2
n
2
2
2
x
For example, x0,1,,N-1 calculate f(x) for all
values of x
Using the quantum superposition, we run the
calculation all at once
1
( (0) gt (1) gt (2) gt - - - (N-1)
gt )
n
2
2
So do we get all of the answers for f(x)?
6Entanglement and Superposition
- Two qubits can have dependent values
Measure either qubit. If youget 0, you know the
otherqubit must be 0.
7Graphic Representation
1
1
1
1
00
01
10
11
4
4
4
4
Each bar is the amplitude of the wave function,
that is, the square root of the probability, of
finding the system in a particular state.
8Example Search
Start with all equalprobabilities
ß
Flip the phase ofthe answer
Flip all states aboutthe mean (average)
The analog nature of phase figuresin strongly!
9Quantum Algorithms
- Deutsch-Jozsa(D-J)
- Proc. R. Soc. London A, 439, 553 (1992)
- Grover's search algorithm
- Phys. Rev. Lett., 79, 325 (1997)
- Shor's algorithm for factoring large numbers
- SIAM J. Comp., 26, 1484 (1997)
D. Deutsch
R. Jozsa
L. K. Grover
P. W. Shor
10Deutsch's Problem
Determine whether a function is constant or
balanced
constantf(x) is either 0 for all x, or 1 for all
x
f(x) (0,0,0,0) or f(x)(1,1,1,1)
e.g., n2
balanced f(x) is 0 for half the values of x, 1
for half the values
f(x) (0,0,1,1)
e.g., n2
classical
Must query 2n-11 times to be certain
f(0) ?
f(1) ?
f(2) ?
11D-J Circuit
n
Ä
0
register
work bit
1
(-1)xzzgt
H
x
2
z
transforms
xgt0gt xgt0 (x)gtxgtf(x)gt
Ä
xgtf(x)gtxgtf(x) f(x)gtxgt0gt
Ä
1
(-1)xzzgt
x
n
2
2
z
S x gt y gt (-1)y x gt y gt
12What Happens in D-J
13D-J (More Efficient Version)
14(No Transcript)
15D-J and Grover
Deutsch-Jozsa takes advantage of interference in
the phase to cancel out unwanted terms in the
superposition. But, D-J uses only 1 and -1 in
the phase and essentially calculates
parity. Grover's algorithm takes advantage of
the full continuous nature of phase to create
interference... (Note Remember, phase applies
to the whole term in the superposition, not just
a single qubit! Shift the phase on any qubit and
you shift it on the whole term in the
superposition.)
16Grover's Search
Classically, would have to check about N/2 items
ß
Hard task!!
items
To use Grover's algorithm, create superposition
of all N inputs
repetitions of the Grover iterator G will produce
ß
N
17Grover's Algorithm Circuit
oracle sometimes called a gate, an unknown
function that tells us if we have the answer
18G Gate Analysis
19G Gate Analysis(2)
20Execution Example, N4
Every value starts with equal amplitude
(probability)
21Execution Example, N8
Every value starts with equal amplitude
22Repeat Count
How many times do we have to repeat G to get the
answer?
23Grover and Shor
Grover uses interference in phase to cancel
unwanted terms. Shor goes a step further,
broadening the range of conditions in which
useful interference occurs, by doing a Fourier
transform...
24Shor's Factoring Algorithm
6703
9929
An efficient classical algorithm for this
problem is not known.
Using classical number field sieve, factoring
anL-bit number is
Using quantum Fouriertransform (QFT), factoring
an L-bit number is
Superpolynomial speedup! (Careful,
technicallynot exponential speedup, and not yet
proven thatno better classical algorithm exists.)
25Quantum Fourier Transform
FFT in quantum form
26(No Transcript)
27(No Transcript)
28Order-finding
29Order-finding Process
30Shor's Algorithm Flow
L is the number we wish to factor pick a random
find smallest r
calculate
NO
YES
calculate
NO
YES
31(No Transcript)
32Factoring L15
33Euclid's Method
Algorithm for finding greatest common
denominator
gcd(494,133)
494
133
3
95
133
95
1
38
95
38
2
19
38
19
2
34? Gate (Circuit)
therefore,
35Back to Factoring L15
r
2
p
gcd( )
a
L
1,
Step.4
calculate
r
2
q
gcd( )
a
L
1,
r
2
a
gcd(48,15)3
1
48
r
2
a
gcd(50,15)5
1
50
15
3
5
Done!
36Other Order-Finding Algos.
- Abelian subgroup, discrete logarithm
- QFT based, but very different in classical
portion of algorithm - Hidden subgroup problems in general
37Main Classes of Algorithms
- 1 Use the QFT to find periodicity
- 2 Grover's algorithm and friends
- 3 Simulating quantum physics
- (D-J seems to fall outside these)
38Architecture Affects Algorithm Efficiency
Long-distance gates
Single line layout, neighbor only
2-qubitgate
Neighbor onlyoperations requireswapping qubits
39Quantum Error Correction
- Discovered by Shor and Calderbank
- Important work done by Steane
- Based on known classical techniques, but with
important extensions - Must correct both bit errors and phase errors
403-bit Code Encoding
Keep a logical qubit in triplicate
Encoding circuit
This protects against single bit-flip
errors,same as in classical coding.
413-bit Code Correction
Bit flip error occurs
How do you correct?Calculate parity pair-wise
results will tell you which bit is in error,then
a simple NOT gate on that bit will correct.
Parity circuit
This bit now holds parity of 1 2
Just measure that bottom bit and you get the
parity of that pairtwo parities can tell you
which bit was in error.
42Wait a Minute!
You said measurement destroys the superposition,
won'twe lose our important quantum state?
Not quite... you only lose as much superposition
as youlearn about the state. This is called a
partial trace.
a 000 gt 0 ß 111 gt 0 gt parity
0
111
0
010
parity
101
parity
parity
43What About Phase?
So far, that gets us bit flip protection. Now we
need phase flip...
This is a basis change, and protects us against
the phase flip error
This code can be combined with the bit flip code
to create the9-bit Shor code.
44Wrap-Up on Algorithms
- Quantum algorithms actually have both quantum
and classical parts - Use of quantum interference based on complex,
analog phase is critical - Period-finding algorithms work well(exponential
speedup over best known algos, but not yet proven
better)