0% found this document useful (0 votes)
17 views57 pages

Topic 4 Quantum Algorithms

The document introduces quantum algorithms, emphasizing the advantages of quantum parallelism over classical parallelism for specific computational tasks. It discusses the Deutsch-Jozsa algorithm, which demonstrates quantum parallelism and interference, and Grover's algorithm, a quantum search algorithm that significantly reduces the number of steps needed to find solutions compared to classical methods. Overall, the document highlights the importance of selecting appropriate quantum algorithms to leverage the unique capabilities of quantum computers.

Uploaded by

fanj631
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views57 pages

Topic 4 Quantum Algorithms

The document introduces quantum algorithms, emphasizing the advantages of quantum parallelism over classical parallelism for specific computational tasks. It discusses the Deutsch-Jozsa algorithm, which demonstrates quantum parallelism and interference, and Grover's algorithm, a quantum search algorithm that significantly reduces the number of steps needed to find solutions compared to classical methods. Overall, the document highlights the importance of selecting appropriate quantum algorithms to leverage the unique capabilities of quantum computers.

Uploaded by

fanj631
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Introduction to Quantum Computation

量子計算導論

Topic 4 Quantum algorithms

1
Preliminary

• The advantages of quantum computers are NOT universal.


• This depends on the appropriate quantum algorithms for particular computational tasks.
• One of the important feature of quantum algorithms is the quantum parallelism.

Classical parallelism:


1
2 n

0  1    2n  1 
Quantum parallelism:

1 ˆ
2 n
U 0  Uˆ 1    Uˆ 2n  1 

• Advantage in the investigation of the global property of the outputs.


• No advantage if, e.g., one wants to know all the details of the outputs. 2
Quantum parallelism
• A simple example
Classical parallelism:

We need four computational resources.

Quantum parallelism:

We “have” all results with one operation!


• Actually, we do not obtain each single result in hand, but the superposition.
2
p (00)   , f (00)
2
p (01)   , f (01) Probabilistically, rather than
2
p (10)   , f (10) deterministically
2
p (11)   , f (11)
Not necessarily extract each single result with 4 runs!
• Advantage in the investigation of the global property of the outputs.
• No advantage if, e.g., one wants to know all the details of the outputs. 3
Deutsch-Jozsa algorithm

• Showing the advantages of quantum parallelism and quantum interference.


• Deutsch game:

X   x | x  0,1, 2, 2  1
n
x Constant: f(X) = 0, or f(X) = 1

Task: which f ?
f ( x)  f ( X / 2)  0
Balanced: 
 f ( X / 2)  1

• Example: for n = 3, at worst, Alice will need to query Bob with x = 0, 1, 2, 3, 4 to obtain
f(0), f(1), f(2), f(3), f(4), to determine f.
• For the classical case, at worst, Alice will need to query Bob at least 2n-1 + 1 times to
determine f.

4
Deutsch-Jozsa algorithm
• Quantum circuit of the Deutsch-Jozsa algorithm:

 0  0 00
  
• n-qubit computational basis in the decimal representation: 
n

1   0 01
 
 n
n 1 n2 0 
  x  x1  2  x2  2    xn 1  21
 xn  2  2  010
n 1  
 x  x1 , x2 , x3 ,  , xn | x  0,1, 2,  , 2   n
      3  011
n
  
 n


 n
 2  1  
111
5
 n
Deutsch-Jozsa algorithm
• Quantum circuit of the Deutsch-Jozsa algorithm:

• Alice superposes all the queries together:


 0  00 00  1  0  1


n
1
 1  Hˆ  n 0  Hˆ 1  Hˆ 0    Hˆ 0  Hˆ 1 




0  1      0  1   Hˆ 1

n
2n n

0 1
n
2 1

1
2n
 n

0  1  2    2  1  Hˆ 1 
1
2n

x 0
x 
2
• Important technique:
0  1    0  1    0  1   000  001  010  011  100  101  110  111
6
 0 1  2  3  4  5  6  7
Deutsch-Jozsa algorithm
• Quantum circuit of the Deutsch-Jozsa algorithm:

• Bob performs the operation Uˆ f x, y  x, y 2 f ( x) , f : X  0,1 once. → Quantum parallelism!

1 2n 1
 0 1  1 2n 1
0  2 f ( x)  1 2 f ( x)
2  Uˆ f  1   f
Uˆ x 
2 
   x 
2
2n x 0  2n x 0

0 1
n
1 2 1
  (  1) f ( x)
x 
2
2n x 0

 0 2 0  12 0 0 1

0  2 f ( x)  1  2 f ( x)  2 2 0 1
  (1) f ( x )
2  0 2 1  1 2 1

0 1 2
7
 2 2
Deutsch-Jozsa algorithm
• Quantum circuit of the Deutsch-Jozsa algorithm:

• Alice determines the type of the function f:


2n 1
0 1 2n 1 2n 1
0 1
1
 (1)   1
  (1) xz  f ( x ) z 

 3  Hˆ n
2  f ( x)
Hˆ n
x   n
2 n
x 0 2 2 z 0 x 0 2
1  2 1  0 1 0 1
n
2n 1 2n 1
1
 n   (1) f ( x )  0    (1) xz  f ( x ) z 

 n
2  x 0  2 2 z 1 x  0 2
2n 1
1 1
  (1) xz z

Hˆ  n x  Hˆ x1  Hˆ x2    Hˆ xn  (1) x1z1  x2 z2  xn zn z1 z2  zn 
  2 n
z1 , z2 ,, zn
 2 n
z 0
n n

• f is constant. → All register qubits are measured to be 0.


→ Quantum interference! 8
• f is balanced. → Some of the register qubits are 1.
Deutsch-Jozsa algorithm
• Experimental demonstration.

9
Nature 536, 63 (2016)
Grover’s algorithm

• Also known as quantum search algorithm. It was proposed by Lov Grover in 1996.
• How do you search M objects through N elements? For a classical computer, this can be
represented by a function f:{0, 1,…, N-1}→{0, 1}, which returns value f(x) = 1 if x is a
solution to the search problem, and f(x) = 0 otherwise. Typically, this takes O(N) steps.
• For a quantum computer with a quantum oracle Ô capable of recognizing the solution
to the search problem, then this can be represented with one more oracle qubit as:

x 0  x 0  f ( x)(mod 2) .
• The oracle qubit is |1⟩ if x is a solution, and is |0⟩ otherwise.
• The representation can be more concise if the oracle qubit is prepared in a superposition:
 0  1  Oˆ  0 1  Oˆ
 (1)   x (1)
f (x) f (x)
x  x  x
 2   2 

• Namely, the oracle marks the solutions to the search problem by flipping the phase of
the solution.
• For an N-item search problem with M solutions, a quantum computer need only O( N / M )
steps, faster than a classical one.

10
Grover’s algorithm
• Schematic of the overall quantum search algorithm:

Grover operator

N 1
1
• The n-qubit state after the Hadamard transform:   Hˆ n
0 
N
 x ,N  2 .
x 0
n

• Step 1 is the oracle Ô performing a reflection about the α-axis:


Step 1

Steps 2~4

• The Grover operator Ĝ consists of four steps. The combined effect of steps 2~4 is
Hˆ  n (2 0 0  Iˆ) Hˆ  n  2    Iˆ → Reflection about the state |ψ〉!
• The overall effect of the Grover operator is written as Ĝ = (2|ψ〉
〈ψ|-Î)Ô. 11
Grover’s algorithm

• Why this circuit works? This can be explained in a geometric


manner.
1 N 1 1 1 N M M
• Note that    x  " x   ' x 
N x0 N x
 
N x

N N
 
 cos   sin 
2 2
1
 
N M x
" x : not solution
1
 
M x
' x : desired solution
• Step 1 is the oracle Ô performing a reflection about the state |α〉:Oˆ (a   b  )  a   b  .
• Steps 2~4 are equivalent to perform a reflection about the state |ψ〉.
3 3
• The overall effect of Ĝ is Gˆ   (2    Iˆ)Oˆ   cos   sin  .
2 2
• Each Grover iteration rotates |𝜓⟩ an angle θ toward |𝛽 ⟩. Repeated application of Ĝ k-times
takes the initial state |𝜓⟩ to
 2k  1   2k  1 
Gˆ k   cos      sin    .
 2   2 
• Repeating Grover iteration R = CloInt[(arccos M / N ) /  ] times rotates |𝜓⟩ most
approaching |𝛽 ⟩ withing a angle θ/2 ≤ π/4. Measuring the state then yields an solution
to the search problem with probability higher than ½ (not deterministically). 12
Grover’s algorithm

• A 2-qubit example; N = 4, M = 1.
• The oracles corresponding to each desired solution :
 f (0)  1  f (1)  1  f (2)  1  f (3)  1
   
 f ( x )  0, x  0  f ( x )  0, x  1  f ( x )  0, x  2  f ( x)  0, x  3

• Quantum circuit of the quantum search algorithm:


0

1 3 3 1  /3  /3
• The state before the Grover iteration is   
4 x0
x 
2
 
2
  cos
2
  sin
2
 .

• Single Grover iteration moves |𝜓⟩ to |𝛽 ⟩. The measurement on the top two qubits gives
exactly the desired solution.
13
Grover’s algorithm
• Experimental demonstrations.

14
Phys. Rev. A 72, 050306(R) (2005) Nat. Commun. 8, 1918 (2017)
Quantum Fourier transform

• (Classical) discrete Fourier transform:


 x0 , x1 , x2 , , xN 1   N 
F
  y0 , y1 , y2 , , y N 1   N
 1 N 1
1
 y0 
N
 xj  N
( x0  x1  x2    xN 1 )
 j 0

 1 N 1 i 2 j
1 2 2
i 2
2
i ( N 1)
e
i
1 N 1 i 2 jk
 y1  N
xj  ( x0  e x1  e
N N
x2    e N xN 1 )
yk  
N j 0
e N
x j   N j 0 N
 N 1 i 2 2 j 2 2 2
1 1 i 2 i 4 i (2 N  2)
 y2 
 N
e
j 0
N
xj 
N
( x0  e N
x1  e N
x2    e N xN 1 )



15
Quantum Fourier transform
• n-qubit quantum Fourier transform in the decimal representation:
Orthonormal basis in the decimal representation:  0 , 1 , 2 , 3 , , 2  1 
n

2n 1 i 2 jk
1
j 
F
 Fˆ  j  : e 2n
k
n
2 k 0

2n 1 
n
2 1 
n
2 1 2n 1  1 2n 1 i 2 jk 
 
   x j j 
F
 Fˆ   x j j    x j Fˆ  j    x j  n e 2n
k 
j 0  j 0  j 0 j 0  2 k 0 
2
 2n 1 1
2n 1 i n jk  2n 1
    x j e 2  k   yk k
k 0  j 0 2n  k 0

2n 1 2n 1
  x j j 
  yk kF

j 0 k 0

16
Quantum Fourier transform
• n-qubit quantum Fourier transform in the binary representation:
2n 1 i 2 j k 1 1 k1 2n1  k2 2n2  kn2 22  k n1 21  kn 20
1 1 i 2 j
j  j1 j2  jn 
F
 Fˆ  j  : e 2n
k    e 2n
k1k2  kn  2 k n 1kn
 2 n
k 0 2 n
k1  0 kn  0
n

1  
1 2 2 1 2n1 22  2 1
i 2 j n i 2 j n i 2 j n i 2 j
Fˆ  j   n / 2 0 00  e
 2
0 01  e 2
010  e 2
011    e 2n
111 
2  
  
  
  
 
  
 n n n n n 
1       
n1 n 2 2
2
i 2 j n
2
i 2 j n
2
i 2 j n
2
i 2 j n   1
i 2 j n 
 n/2  0  e 2 1    0  e 2
1      0  e 2 1    0  e 2 1    0  e 2 1 
2   
 




 
   
      
1 n2 1 n 1
j 2  j j 2  jn1 2  jn j 2  jn1  21  jn
1  j
i 2 n i 2 n1 2 n i 2 2 i 2 1
 n/2  0  e 2
1  0  e 2
1     0  e 2n1
1  0  e 2n
1
2  
      
    
1
    
 n / 2 0  ei 2 (0. jn ) 1  0  ei 2 (0. jn1 jn ) 1    0  ei 2 (0. j2 j3 jn1 jn ) 1 
2
 0  ei 2 (0. j1 j2 j3 jn1 jn ) 1 
2 2 j1  2n j2  2n  2    jn 1  21  jn
i 2 j n  i 2 ( j1  2  j2  2    jn 1  2  jn ) n  i 2
n 1 n2 1
 i 2
2 2 2n 2n 1
• Meaning of digits:
decimal: 1234  1103  2 102  3 101  4 100
0.123  1 101  2 102  3  103
binary: 1101  1 23  1 22  0  21  1 20  13
1 0 1
0.101  1 21  0  22  1 23     0.625 17
2 4 8
Quantum Fourier transform
• n-qubit quantum Fourier transform in the binary representation:
     
1 2 1 n 1 1
j 2  j j 2  jn1 2  jn j 2  jn1 2  jn
1  j
 i 2 n1 2 n i 2  n2 i 2 1
Fˆ  j1 j2  jn   n / 2  0  e
i 2 n
1  0  e 1  0  e 1     0  e 1
3 n
2 2 2 2
2  
      
    
1
      
 n / 2 0  ei 2 (0. jn ) 1  0  e i 2 (0. jn1 jn ) 1  0  ei 2 (0. jn2 jn1 jn ) 1    0  ei 2 (0. j1 j2  jn ) 1
2

• Quantum circuit of the quantum Fourier transform (up to swap operations):

1 0  1 0  1 0  1 0  1 0 
where Rk   2  R1   2     R2   2  R3   2 
0 e 2 
i k
 0 ei 2   0 1 0 e 2 
i 2
0 e 2 
i 3
       
 1
 H 0  (0 1) j
21/ 2 1 i 2 k 1
• Note that   H jk  1/ 2 ( 0  e 2 1 )  1/ 2 ( 0  ei 2 (0. jk ) 1 )
H 1  1 ( 0  1 ) 2 2
 21/ 2
• We need n(n+1)/2 gates plus n/2 swap gates. → a Θ(n2) algorithm.
18
• Classical FFT needs Θ(n2n) gates.
Quantum Fourier transform
• Experimental demonstration.

19
Nature 536, 63 (2016)
Phase estimation

• Given a unitary operator (of any dimension) Û, it can be expressed in terms of the
eigenvalue decomposition Uˆ   ei 2 u u .
u

• Suppose that we have an unknown unitary operator Û (sometimes known as oracles) with
an eigenstate |u〉 (could be also unknown) prepared in advance, such that Uˆ u  ei 2 u .
What is the corresponding phase φ?
• Not that φ lies between 0 and 1; 0 < φ < 1.
• Schematic of the overall phase estimation procedure:

t-qubit register

Second stage

First stage
20
Phase estimation

• First stage of the phase estimation.

• Output state:
 
1

2n / 2
0  e  
i 2 2t 1 
1  0  e 
i 2 2t 2 
1   
 0  e i 2 2 2 
 
1  0  e i 2 21 
1 
 0  e i 2 20 
1 u 
• Suppose that φ can be exactly expressed with t digits in the binary representation
as φ = 0.φ1φ2…φt-1φt. Then
1
 
2 n/2        
0  ei 2 (0.t ) 1  0  ei 2 (0.t1t ) 1    0  ei 2 (0.2 t 1t ) 1  0  ei 2 (0.12t1t ) 1  u

• In fact, we do not know the exact number of t in advance. The number of qubits t depends
21
on the accuracy we wish to have in the estimation of φ.
Phase estimation

• Second stage of the phase estimation.

• The input state of the inverse FT is


1
 in 
2n /2
0  e i 2 (0.t )
 
1  0  e i 2 (0.t 1t )
1   0  e 
i 2 (0. 2 t 1t )
1  
0  e i 2 (0.12 t 1t )
1 u .

• The output state of the inverse FT is


 out  1 2 t 1t  u .

• The final measurements on each qubit determine the values of φj’s to be 0 or 1.


1 2 t 1 t
• The desired result is   0.12 t 1t     .
2 22 2t 1 2t 22
Order-finding

• A very important application of phase estimation algorithm.


• To understand the quantum algorithm for order-finding requires a little background in
number theory.
• Mathematical supplement of number theory:
1. Given positive integers x and n, the result of dividing x by n with remainder q can be
uniquely written as:
x = kn + q.
2. This can be expressed in terms of the modular notation, x equals q modulo n, as:
x = q(mod n).
3. We use the modular notation to indicate that we are working in modular arithmetic in
which we only pay attention to remainders. For example, 2 = 5 = 8 = 11(mod 3).
4. For positive integers x and N, x < N, with no common factors, the order of x modulo
N is the least positive integer r, such that xr = 1(mod N).
5. For example, 51 = 5 (mod 31), 52 = 25 (mod 31), 53 = 1 (mod 31).
6. The order-finding problem is to determine the order for given x and N.
7. [Theorem] 𝑟 ≤ 𝑁.
8. Order-finding is believed to be hard for a classical computer, in the sense that no
algorithm is known to solve the problem using resources polynomial in the O(L) bits
needed to specify the problem, where L  log 2 ( N )   log 2 ( N ) is the number of bits needed
23
to specify N.
Order-finding

• [Problem] Suppose that x and N are given, we want to find the order r such that xr =
1(mod N).
• The basis of L-qubit register in the decimal representation:
 
 y | y  0,1, 2, , N  1, N , , 2  1   0  0
L
00 , 1  0 01 , 2  010 , 3  011 , , 2  1  111 
      
 
L
 
 L L L L L 
 xy (mod N ) , 0  y  N  1
• Consider the unitary operator: Uˆ y  
 y (mod N ) , N  y  2  1
L

1 r 1 2  s  k  k
• For integer 0 ≤ 𝑠 ≤ 𝑟 − 1, the state us   exp  i  x (mod N ) is an eigenstate
r k 0  r
of Û with eigenvalue exp(i2πs/r).
Example: x = 5, N = 31
2 s 1 2   s 2
1  0 i i 
us   5 (mod 31)  e 3
51
(mod 31)  e 3
5 2
(mod 31) 
3 
2  s1 2  s2
1  i i 
  1(mod 31)  e 3
5(mod 31)  e 3
25(mod 31) 
3 
2 s 1 2  s  2
1  i i 
Uˆ us   51
(mod 31)  e 3
5 2
(mod 31)  e 3
53
(mod 31) 
3 
2 s 1 2  s 1 2  s 2 2  s
i 1  i i  i
e 3 e
3
5 (mod 31)  e 3 5 (mod 31)  1(mod 31)   e 3 us
1 2
24
3 
Order-finding

• Order-finding problem becomes a phase estimation problem:


s
i 2
xr = 1 (mod N) Uˆ us  e r us

• Application of the phase estimation algorithm:

s s

• There are still three issues:


j
1. Efficient computation of controlled-U2 .
2. Preparation of eigenstate |us〉 requires that we know r.
3. Obtaining r from the estimated phase.

25
Order-finding

• [Issue 1] Suppose that we know Û|y〉= |xy(mod N), 0 ≤ y ≤ N-1. How can we compute
j
the sequence of controlled-U2 ?
• Modular exponential xz(mod N)
z y  z Uˆ zt 2 Uˆ z3 2 Uˆ z2 2 Uˆ z1 2 y  z x zt 2    x z3 2  x z2 2  x z1 2 y (mod N )
t 1 2 1 0 t 1 2 1 0

t 1
 z3 2 2  z2 21  z1 20
 z x zt 2 y (mod N )  z x z y (mod N ) .

• [Issue 2] How to circumvent the dependence on r of the initial eigenstate preparation?


• Note that 1 r 1
r
 u
s 0
s 1.

• We use t  2 L  1  log 2 2  (2 ) 1  qubits in the first register and prepare the second
register in |1〉.
• Schematic of the overall order-finding procedure:

26
Order-finding
r 1
1
• The output state of the inverse FT (before performing the measurement) is
r

s 0
s us .
s
i 2
Uˆ us  e r us

s s

r 1 r 1
s 1 1
0 us   s
PhaseEstimation
us ,  s 
r
0 1 
r

s 0
0 us 
PhaseEstimation

r

s 0
s us

• After the measurement, we will obtain certain one 𝜑 ∈ {𝜑 , 𝜑 , 𝜑 , … , 𝜑 }.


• φs is an estimation of the phase φs ≈ s/r accurate to 2L+1 bits, with probability at least (1-
ε)/r, for certain one 0 ≤ s ≤ r-1.
Example: x = 5, N = 31, L = 5, t = 12
0 0 0 0 0
0  0000 0  0   2
 3  4    12  0
2 2 2 2 2
0 1 0 1 1
1  01011  1   2  3  4    12  0.333252...
2 2 2 2 2
1 0 1 0 0
 2  1010 0   2   2  3  4    12  0.666504... 27
2 2 2 2 2
Order-finding

• [Issue 3] Suppose that we have measured one φs. It is an approximation to the correct s/r
accurate to 2L+1 bits. How can we retrieve r from φs?
• The continued fraction is the representation of a real number by a sequence of integers:
1
 a0 , a1 , , aM  : a0  e.g. 31  2  5  2  1  2  1    2  1
  2, 2,1,1, 2
1 13 13 13 3 1
a1  2 2
1 5 5 1
 1
aM 1
1
2
• Suppose that φs = [a0, a1,…, aM] is a good approximation to s/r, i.e., |(s/r) - φs | ≤ 1/(2r2),
then s/r is a convergent of the continued fraction, i.e., [a0, a1,…, am] for 0 ≤ m ≤ M.
• [Final solution] By cutting the continued fraction for φs at different lengths, we obtain
several convergents for the candidate s’/r’. We then check whether these r’ are the
answer to the order-finding problem xr = 1(mod N).
Example: x = 5, N = 31, L = 5, t = 12
1365 1 1
1  0.333252...   0
1
  0, 3,1365  0  0  0,3  0 
4096 3 3
1365
1365 1 1 1 1 2
 2  0.666504...    0,1,1,1, 682 0,1  0   1 0,1,1  0  1  0,1,1,1  0  1

2048 1 1 2 1 3
1 1
1
1 28
Factoring

• To compute the product of two integers is (in principle) easy.


• However, given a positive composite integer, how can one efficiently find out the prime
factors? This problem, prime factorization, cannot be solved efficiently with classical
computer.
• It turns out that prime factorization is an important problem from various aspect,
particularly the cryptography and the associated applications.
• Factoring problem is shown to be equivalent to the order-finding problem!
• To see this, we need two theorems.

29
Factoring
Theorem
Suppose N is an L-bit composite number, and 1 ≤ x ≤ N is a non-trivial
solution to the equation x2 = 1 (mod N), that is, neither x = 1 (mod N) nor
x = -1 = N-1 (mod N). Then at least one of gcd(x-1, N) and gcd(x+1, N) is
a non-trivial factor of N that can be computed using O(L3) operations.

Theorem
Suppose N = p1a1… pmam is the prime factorization of an odd composite
positive integer. Let 1 ≤ x ≤ N-1 be an integer chosen at random, subject
to the requirement that x is co-prime to N. Let r be the order of x modulo
N. Then
p(r is even and xr/2 ≠ -1(mod N)) ≥ 1 – 2-m.

30
Factoring
Factoring algorithm
1. Determine if N is trivially factorisable.
2. Randomly choose 1 ≤ x ≤ N-1. If gcd(x, N) > 1, return it.
3. To find the order r of x modulo N.
4. If r is even and xr/2 ≠ -1(mod N), then compute gcd(xr/2 -1, N) and
gcd(xr/2 +1, N). Each of these two integers may be a non-trivial factor
of N.
5. If not, repeat step 2.~4.

Example [factoring 91]:


1. Suppose that we wish to factor N = 91.
2. [Step 2] We choose x = 9, gcd(9,91)=1.
3. [Step 3] The order of 9 is 3: 91 = 9 (mod 91), 92 = 81 (mod 91), 93 = 1 (mod 91).
4. [Step 4] The order of 9 is odd. The algorithm fails.
5. [Step 2] We choose x = 4, gcd(4,91)=1.
6. [Step 3] The order of 4 is 6: 43 = 64 (mod 91), 44 = 74 (mod 91), 45 = 23 (mod 91), 46 = 1
(mod 91).
7. [Step 4] The order of 4 is even. Furthermore, 46/2 = 64 ≠ -1(mod 91).
8. [Step 4] The algorithm succeeds, giving gcd(64 -1, 91) = 7.
9. [Successful factorizing] One can find out that 91 = 7 x 13. 31
Factoring
• Experimental demonstrations of factoring 15 = 3 x 5.

Phys. Rev. Lett. 99, 250504 (2007).

Nature 414, 883-887 (2001).

Phys. Rev. Lett. 99, 250505 (2007).

32
Factoring
• Experimental demonstrations of factoring 21 = 3 x 7.

Nat. Photonics 6, 773 (2012). Sci. Rep. 11, 16599 (2021).

33
Amplitude estimation

• Given a unitary operator 𝑈 acting on n+1 qubits such that 𝑈|0⊗ ⊗ |0⟩ =
1 − 𝑎|𝜓 ⟩ ⊗ |0⟩ + 𝑎|𝜓 ⟩ ⊗ |1⟩, where 𝑎 ∈ [0,1] is unknow and |𝜓 ⟩ and |𝜓 ⟩
are two n-qubit (normalized) states, not necessarily orthogonal. How to estimate 𝑎?
• The AE algorithm was first introduced in [Contem. Mathemat. 305, 53-74 (2002)]. It
combines the phase estimation (PE) and the Grover’s algorithm.
• Defining the oracle ˆ ˆ Uˆ † Sˆ ,
Qˆ  US 0 0 where Sˆ 0  Iˆ  2  0 n
 0 n  0 0 and Sˆ0  2 0 n 0 n  Iˆ.
• Quantum circuit for the AE algorithm (notice the similarity to the PE algorithm):

P̂  34
Amplitude estimation 0  0

Uˆ 0 n 1
• Similarly, the AE algorithm can be understood in a geometric manner.
 a
• Note that Uˆ 0 n  0  1  a  0  0  a  1  1
1  1
 sin  a  0  0  cos  a  1  1 , 0   a  1

• The oracle Qˆ  (USˆ ˆ Uˆ † )( Sˆ ) can be divided into two steps.


0 
0

• The first step Sˆ  Iˆ  2  0 n  0 n  0 0 is a reflection about the state Qˆ  1  1


ˆ ˆ Uˆ † is a reflection about the Qˆ  0
0

|𝜓 ⟩ ⊗ |1⟩, while the second step US  0 Uˆ 0 n 1


0
⊗  a
state 𝑈|0 ⊗ |0⟩.
• The overall effect of the oracle can be understood from the action on
the two basis states Qˆ   1  cos 2   1  sin 2   0
 1 a 1 a 0
 .
ˆ
Q  0  0 =  sin 2 a  1  1  cos 2 a  0  0

• The oracle can also be expressed as an eigenvalue problem


Qˆ    ei 2a  
 ,
ˆ
Q    e
 i 2 a

1 i
with eigenvalues e  i 2a  cos 2 a  i sin 2 a and eigenvectors    0  0  1  1 .
2 2
• Recast the problem into the basis of the two eigenvectors:
i i a
Uˆ 0 n  0 
2
 
e    e  ia   , e  ia  cos  a  i sin  a 35
Amplitude estimation

• Go back to the quantum circuit

P̂ 

• The first stage of the algorithm is to prepare the eigen state |𝜓 ⟩ with Pˆ 
 0 n 1   .

36
Amplitude estimation

• Go back to the quantum circuit

P̂ 

• Recall the action of the oracle on the eigenstate: 𝑄 |𝜓 ⟩ = 𝑒 |𝜓 ⟩.


• Output state of the second stage of the algorithm:
 
1
2n / 2
0  e i 2 2m1  a
 
1  0  e 
i 2  2m 2  a
1    0 e i 2 2 2  a
 
1  0  e  
i 2 21  a
1  0  e 
i 2  20  a
1  

1
       
 n / 2 0  ei 2 (0.m ) 1  0  ei 2 (0. m1m ) 1    0  ei 2 (0.2  m1 m ) 1  0  ei 2 (0.12 m1m ) 1    .
2
37
(binary representation of θa in m digits)
Amplitude estimation

• Go back to the quantum circuit

P̂ 

• The final stage is the inverse FT.


• Input state of the inverse FT is
1
 
2 n/2        
0  ei 2 (0.m ) 1  0  ei 2 (0.m1 m ) 1    0  ei 2 (0. 2  m1m ) 1  0  ei 2 (0.12 m1 m ) 1    ,
while the output state of the inverse FT is  out  1 2  m 1 m .
• The final measurements on each qubit determine the values of θj’s to be 0 or 1.
• The desired result is  a  0.1 2  m 1 m  1   22    mm11   mm . 38
2 2 2 2
HHL algorithm

• A quantum algorithm for solving linear system of equations proposed by


Harrow, Hassidim, and Lloyd.

• May not necessary efficient to extract full information of the solution 𝑥⃗.
• Typically for solving the expectation value 𝑥⃗ ⋅ 𝑀 ⋅ 𝑥⃗.

39
HHL algorithm
• A quick review how we solve linear system of equations.
• Linear system of equations: 𝐴𝑥⃗ = 𝑏

• Assumption: 1. 𝐴 is an Hermitian matrix and 2. 𝑏 is a unit vector.


• Diagonalization of 𝐴:

where and

• Solution:

• Solving 𝐴𝑥⃗ = 𝑏 amounts to find out the eigenvalues {𝜆 , 𝜆 , … } of 𝐴.


40
→ Application of quantum phase estimation algorithm.
HHL algorithm

• Assumption 2.: 𝑏 is a unit vector. → |𝑏⟩ = 𝑏 |1⟩ + 𝑏 |2⟩ + ⋯ is a quantum state.

and are the same quantum states in different basis.

• Now working with the basis given by the eigenvectors of A , {|𝑢 ⟩, |𝑢 ⟩,…}.
|𝑏⟩ = 𝑏 |𝑢 ⟩ + 𝑏 |𝑢 ⟩ + ⋯

𝐴 = (2𝜋𝜆 )|𝑢 ⟩⟨𝑢 | + (2𝜋𝜆 )|𝑢 ⟩⟨𝑢 | + ⋯ → Rescaling the eigenvalues such
that0 ≤ 𝜆 < 1.
• Recall the binary representation of 𝜆 in t digits.
( ) ( ) ( )
𝜆 = 0. 𝜆 𝜆 𝜆 …𝜆 = + + ⋯+ , 𝜆 ,𝜆 ,…,𝜆 ∈ {0,1}

|𝜆 = |𝜆 𝜆 …𝜆

• The goal of the HHL algorithm is to fabricate a state |𝑥 ⟩ = 𝐴 |𝑏⟩ = ∑ |𝑢 .

41
HHL algorithm

• Schematic of the overall phase HHL algorithm:


Phase estimation Inverse phase estimation

Initial state: |Ψ ⟩ = |0⟩|0⟩⊗ |𝑏⟩ .


|𝑏⟩ = 𝑏 |1⟩ + 𝑏 |2⟩ + ⋯ can be prepared by using the
amplitude encoding with respect to the coefficients {𝑏 , 𝑏 , … }.
Phase estimation: |Ψ ⟩ = 𝑃𝐸{|Ψ ⟩} = |0⟩𝑃𝐸{|0⟩⊗ ∑ 𝑏 |𝑢 } = |0⟩ ∑ 𝑏 |𝜆 |𝑢 .

• Compare with our goal |𝑥 ⟩ = ∑ |𝑢 , we need to put the eigenvalues at the denominator.
• This is achieved by the controlled Ry-rotation subroutine. 42
HHL algorithm

• Subroutine: controlled Ry-rotation

Phase estimation: |Ψ ⟩ = |0⟩ ∑ 𝑏 |𝜆 |𝑢 .


Recall that |𝜆 = |𝜆 𝜆 …𝜆 , and 𝜆 ,𝜆 ,…,𝜆 ∈ {0,1}.
Controlled Ry-rotation:
( ) ( )
|Ψ ⟩ = ∑ 𝑏 𝑐𝑜𝑠 |0⟩ + 𝑠𝑖𝑛 |1⟩ |𝜆 |𝑢 , where 𝜆⃗( )
𝜃⃗ = 𝜆 𝜃 + ⋯+ 𝜆 𝜃.
• The parameters 𝜃’s are determined by setting
( ) ( )
𝑐𝑜𝑠 |0⟩ + 𝑠𝑖𝑛 |1⟩ = 1− |0⟩ + |1⟩, ∀ 𝑗.
• Note that the 𝜃’s may not necessarily be unique when t is larger than #j.
• 𝐶 is a constant to make 0 ≤ ≤ 1 as larger as possible. 43
HHL algorithm

• Subroutine: controlled Ry-rotation

Controlled Ry-rotation: |Ψ ⟩ = ∑ 𝑏 1− |0⟩ + |1⟩ |𝜆 |𝑢 .

• Measuring the ancillary qubit and postselecting the outcome 1. Then we have

|Ψ ⟩ = |1⟩ ∑ |𝜆 |𝑢 , with normalization constant 𝑁 = ∑ .

• Finally, the IPE maps all |𝜆 |𝑢 to |0⟩⊗ |𝑢 . Then we have

|Ψ ⟩ = |1⟩|0⟩⊗ ∑ |𝑢 .

44
HHL algorithm

• Experimental realization

45
Simulating open quantum systems

• Every quantum gate (single qubit gate or multiqubit gate) provided by quantum computing
platforms, e.g., IBM Q, is an unitary operator.

• Ideally, neither decoherence nor incoherent states on an ideal quantum computer.

• An authentic quantum system inevitably interacts with a surrounding environment, leading


to decoherence. The reduced state is described by a dynamical linear map:
û(  )  TrenvUˆ (    env )Uˆ † .
• Mathematical description: operator-sum representation (Kraus operators).
û(  )   Eˆ k  Eˆ k† .
k

• A prototypical quantum circuit for simulating an open quantum system:

46
Simulating open quantum systems

• Depolarizing channel: û(  )  p  (1  p ) 
2
• Bloch sphere representation of the effect of the depolarizing channel:

• Operator-sum representation: û(  )  p Xˆ  Xˆ  p Yˆ Yˆ  p Zˆ  Zˆ  (1  p) 


3 3 3

• A prototypical quantum circuit for depolarization channel:


û(  )

47
Simulating open quantum systems
1 0  0 
• Amplitude damping channel: û(  )  Eˆ1  Eˆ1†  Eˆ 2  Eˆ 2† , Eˆ1   , ˆ
E
 2   
 0 1    0 0 
• Bloch sphere representation of the effect of the amplitude damping channel:

• A prototypical quantum circuit for amplitude damping channel:


 out  Trq[ 2]  2
a c  1 0 
1     2   
c

b   0 0   a  b sin c cos
 2 2
    
 a c sin c cos 0  c  cos  
b cos 2 
2 2  2 2 
 
 c  sin  b sin 2
 b
sin

0
2   2 2 2 2  
  sin 2
1 2
 
 c cos  b
sin

b cos 2

0 2
 2 2 2 2 
 0 0 0 0  48

Simulating open quantum systems
1 0  0 0 
• Phase damping channel: û(  )  Eˆ1  Eˆ1†  Eˆ 2  Eˆ 2† , Eˆ1   , ˆ
E
 2   
 0 1     0  
• Bloch sphere representation of the effect of the phase damping channel:

• A prototypical quantum circuit for phase damping channel:


 out  Trq[2]  2
a c  1 0 
1     
c

b   0 0   a c cos 
 2
    
 a 0 c cos c sin  c cos  b 
2 2  2 
 
 0 0 0 0 
2      b  
0 b cos 2 sin     sin 2
1 2
 c cos
 2 2 2  2
   b 
 c sin 0 sin  b sin 2  49
 2 2 2
Simulating open quantum systems
• Further sophisticated simulations.

npj Quantum Inf. 5, 106 (2019).


Total Hamiltonian of a spin chain:

npj Quantum Inf. 6, 1 (2020).


Discretized time steps: Markovian environment
Uˆ (t )  e  Uˆ ( t )Uˆ ( t ) Uˆ ( t )
ˆ
 iHt
engineering
Trotter decomposition
Hˆ  Aˆ  Bˆ ,[ Aˆ , Bˆ ]  0
Uˆ ( t )  e i ( A B ) t  e  iAt e  iBt  Oˆ ( t 2 )
ˆ ˆ ˆ ˆ

non-Markovian AD non-Markovian DP

50
Hybrid quantum-classical algorithms

• The computing power of near-term quantum computers remains limited due to, e.g.,
noises, qubit lifetime, intrinsic limitations of the physical devices, lack of appropriate
quantum algorithms, …
• An alternative approach is to combine quantum and conventional computers.
• We briefly introduce three examples:
1. Quantum support vector machine
2. Variational quantum eigensolver
Variational quantum algorithms
3. Quantum neural network

51
Quantum support vector machine
• Support vector machine (SVM) is a well-developed machine algorithm.
The basic idea underlying SVM is to construct a hyperplane to separate the datasets belonging to
distinct classes. More specifically, considering a binary classification task with training dataset
{(𝑥⃗ , 𝑦 )}, where 𝑥⃗ ∈ ℝ is the feature and 𝑦 ∈ {𝑅𝑒𝑑, 𝐵𝑙𝑢𝑒} is the label. Suppose that the data is
linearly separable, then goal of SVM is to find a vector 𝑤 ∈ ℝ and a parameter 𝑤 ∈ ℝ such that
𝑤 𝑥⃗ + 𝑤 ≥ 0, 𝑓𝑜𝑟 𝑦 = 𝑅𝑒𝑑
𝑤 𝑥⃗ + 𝑤 ≤ 0, 𝑓𝑜𝑟 𝑦 = 𝐵𝑙𝑢𝑒
,
meanwhile maximize the margin, which is the distance between the closest training points (the
support vectors) and the separating hyperplane 𝑤 𝑥⃗ + 𝑤 = 0.
• In most practical problems, the datasets are not linear separable. Then we need further
techniques.
• Feature map: mapping the data to higher dimensional parameter space.

• Kernel matrix 𝐾 = [𝑘(𝑥⃗ , 𝑥⃗ )]: estimation of the similarity between data points in the
higher dimensional parameter space without explicitly refer to the feature map.
52
• Then the classifier can be trained based on the kernel matrix 𝐾 .
Quantum support vector machine
• QSVM was first proposed in 2014. However, one of the critical issues is the assumption
that the data can be efficiently accessed quantum mechanically.

• Quantum feature map was introduced in 2019 to overcome the data accessibility.

• Implementation of quantum feature map with parameterized quantum circuits on IBMQ.


Nature 567, 209 (2019)

53
Quantum support vector machine
• Advantage of QSVM was proved for a heuristic problem.

Nat. Phys. 17, 1013 (2021)

• Estimating kernel function with quantum circuits.


parametrized quantum circuits: 𝑈(𝑥⃗ )
feature map: |𝑥⃗ ⟩ = 𝑈(𝑥⃗ )|0⊗
quantum kernel: 𝑘 𝑥⃗ , 𝑥⃗ = 𝑥⃗ 𝑥⃗ = 0⊗ |𝑈 (𝑥⃗ )𝑈(𝑥⃗ )|0⊗

• An explicit example: zz feature map.

54
Variational quantum algorithms

Nat. Rev. Phys. 3, 625 (2021)

• VQAs are hybrid algorithm combining the computing power of quantum and
classical computers.
• VQAs implement parametrized quantum circuits on quantum computers and
optimize the parameters with classical computers.
• Prominent applications include the variational quantum eigensolver and quantum
neural network.

55
Variational quantum eigensovler

Nat. Commun. 5, 4213 (2014) Phys. Rev. X 6, 031007 (2016)

• Schrödinger equation: an eigenvalue problem 𝐻 |𝜓 = 𝐸 |𝜓


• Trial ansatz with parametrized quantum circuit: |𝜓(𝜃⃗ ) = 𝑈(𝜃⃗ )|0⊗
• Objective function: expectation value 𝑓(𝜃⃗ ) = 𝐻 = 𝜓(𝜃⃗ ) 𝐻 𝜓(𝜃⃗ ) ≥ 𝐸
• Goal: optimizing 𝜃⃗ such that 𝑓(𝜃⃗ ) → 𝐸 56
Quantum neural network

• Artificial neural network (ANN)

• Quantum neural network (QNN)

57

You might also like