Professional Documents
Culture Documents
Lecture 3: Algorithms
Quantum Algorithms
• Simulation algorithms
– Simulation of quantum systems
– Tools for physicists
• Search algorithms
– Deutsch-Jozsa algorithm (1992)
– Grover’s algorithm (1996)
– Searching unstructured databases
• DFT-based algorithms
– Shor’s algorithm (1994)
– Discrete logarithms
– Factoring large integers
Grover’s Algorithm
On O n
• and because
1 1
NOT : 0 1 a (1) 0 1
2 2
• We will have
1 1
UO : x 0 1 a 1
fd x
x 0 1
2 2
Grover’s Algorithm
1 n 1
Initial state ?
i H n 00...0 a n x
n 2 2 x 0
0
Oracle
Workspace
( m 1)
0 1
Grover’s Algorithm
Hadamard
• The “Gro” circuit transform
Oracle
levels
Phase shift 0 if x 0
Ph : x
circuit x if x 0
Grover’s Algorithm
U Gro 2 i i I U O
Grover’s Algorithm
New basis: ,
1
nk
x
xS
1
k
x
xS
Iterations: n
q
4 k
n
O
k
Grover’s Algorithm
4
2 10
Poly ( x)
Exp( x)
4
1 10
0
0 5 10 15 20
x
• Step 2:
1 i o 0 0
• Step 3:
1 2 2 L 1
– f is periodic
– factors:
2 L
2 i 0
i 0
2 2 L 1
1
3
2 L i
i 0
f (i )
f a , N x a x mod N
r
gcd a 2 1, N , r mod N 1
fa,N(x)
Shor’s Algorithm
• Step 4: output register measurement
22 L
1
r
r
4 2L
2
r i b
i 0
m
0.4
0.3
0.2
0.1