Professional Documents
Culture Documents
Deb 2 Report
Deb 2 Report
Algorithm
By
Debasis Sadhukhan
M.Sc. Student
Roll No.: 10512029
Department of Physics
Indian Institute of Technology Bombay
Mumbai 400076, India
April 2012
PROJECT CERTIFICATE
This report had not been submitted for any other examination and does
not form a part of any other course undergone by the candidate.
Date: ·····················
Signature
Project Supervisor
Prof. T. A. Tulsi
Department of Physics
IIT Bombay, Mumbai, India
i
Acceptance Certificate
···········································································
Department of Physics, Indian Institute of Technology Bombay
Date: ·····················
Signature
Project Supervisor
Date: ·····················
Signature
Examinar
Date: ·····················
Signature
Chairman
ii
Declaration
Date: ·····················
Signature
Debasis Sadhukhan
M.Sc. Student
Department of Physics
IIT Bombay, Mumbai, India
iii
Acknowledgments
iv
Abstract
v
Contents
Declaration iii
Acknowledgments iv
Abstract v
vi
4.1.1 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1.2 Numerical Simulation . . . . . . . . . . . . . . . . . . . 21
4.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2.1 Example-1 . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2.2 Example-2 . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.3 Example-3 . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.4 Example-4 . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Summery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
vii
List of Tables
viii
List of Figures
ix
Chapter 1
1
and the shirking size of the elementary components in a chip suggests us that
the computer technology will inevitably encounter the dynamics of atomic
scale[3, 4]. We must apply the laws of quantum mechanics to analyze the
computational framework because quantum objects are both “particle-like”
and “wave-like”. Here, the superposition principle allows not only the dis-
crete eigenstates that forms the Hilbert space basis, but also the simultaneous
existence of multiple components. And that is where the advantage quantum
algorithm lies.
But since our intuition lies in the classical world, it is hard to design a
quantum algorithm. Also, one need to make sure that the new algorithm
must be more efficient than the existing classical ones2 . That is why so less
number of quantum algorithms has been discovered so far.
As of now there are only two main class of quantum algorithm. One is
1
Note that, execution of a quantum algorithm requires a quantum computer.
2
The full exponential advantage provided by the quantum superposition can not be
always used to make the quantum solution to be exponentially faster than the classical
one.
2
Shor’s algorithm for factoring large integers[5], based on an exponentially
faster quantum Fourier transform to the period finding problem. And the
other is Grover’s algorithm for searching an object in an unsorted database[6],
which provides a quadratic speed-up.
3
Chapter 2
The problem of database search is to find an item with the desired prop-
erties from the collection. A search operator needs a oracle like that search
for a specific items with the desired properties by checking every items with
desired items in the database. An efficient search process is the one which
can locate the desired item in the database using the least application of
oracles.
4
2.2 Grover’s Quantum Search Algorithm
5
we will call our solution to be target(t). Now, we define a binary function
f (i), such that,
f (i) = 1 f or i=t
=0 f or i 6= t (2.1)
Now, assume that we have a quantum oracle1 that will do the operation,
specified by the function f (i).
where, |ii is the index register, ⊕ denotes addition modulo 2, |qi is the
ancilla qubit, which is flipped if f (i) = 1 and is unchanged otherwise.
Notice that, if we construct |qi such that |qif lipped = − |qi, then when
f (i) = 1, we can write |qi = (−1)f (i) |qi. An example of such |qi will be
|0i−|1i
√
2
. The action of the oracle is then:
1
Oracle is a black box that will perform some operation, but we don’t know it’s internal
hardware working principal.
6
So, one can write the uniform superposition to be,
N −1
r r
1 X M N −M
|ψi = √ |ji = |ti + |t⊥ i (2.6)
N j=0 N N
Let us assume |si makes angle θ with |t⊥ i. After operation of It , the
component of |si along |ti get flipped. So, It |si makes an angle 2θ with |si.
Now, (−Is ) will flip the component perpendicular to |si. So, (−Is It ) |si will
now make an angle 3θ with |t⊥ i.
So, in one iteration we move an angle 2θ towards our desired state |ti.
7
Let’a say, after m iteration we will get our solution |ti, so
π
m(2θ) = − θ
2
π 1
So, m= − (2.9)
4θ 2
q
Now, from figure 2.2, we can see that , cos( π2 − θ) = sin θ = hs| ti = N1 for
q
one solution and M N
for M solution. In general, N is very large compared
to M . So, we can assume that sin θ ≈ θ. Thus, no of iteration required is :
1 r N
m=O =O (2.10)
θ M
2.2.4 Example
With a database of total√ 49 items and 1 target item, number of Grover’s
iteration required = π4 ∗ 49 − 21 = 4.9977 ≈ 5. So, after 5 iteration we will
8
2.2.5 Limitation
For a problem with database size N and M target state,we have seen that
we get a quadratic speed
qupover the classical counterpart using the quantum
N
search i.e. we need O M
trials. Notice that if we do not know the exact
number of solutions i.e. M , we may may not reach to our desired solution
state as no of iteration explicitly depend on M . To overcome this problem,
we first need to estimate the no of solution in our database. By combining
the phase estimation technique with the Grover’s algorithm we can count the
no of solution state in our database. By estimating the the eigenvalues of
the Grover’s iteration G, we can determine the no of solution M.
It is easy to see that the result depends only on | ht| si | and not on ht| si.
The phases of various components of |si can therefore be arbitrary[1]. The
quantum algorithm for searching an unsorted database does not assume any
specific structure or pattern as far as the input data are concerned. This
makes it highly versatile with broad utility. The algorithm can be applied,
either in full or in part, in the quantum solutions of a variety of problems
such as square-root speed-up of solutions to NP-complete problems, finding
mean and median of statistical distributions, locating minimum of a function,
quantum counting, deciphering cryptographic codes, etc[7].
9
Chapter 3
Grover’s search operator has been generalized in several ways ( see [8]
and references therein). In this chapter, we generalize it to the case when
the search operator involves the selective phase inversions of two source states
and two target states. Mathematically, the search operator discussed in this
chapter is,
where,
10
space.
So,
Since, |t1 i, |t2 i and |j1 i, |j2 i are the basis states of our N dimensional
Hilbert space, we can say, by the property of Walsh-Hadamard transform
1
hsi | tj i = (−1)fij √ (3.5)
N
where fij is either 0 or 1 and i, j runs from 1 to 2.
In this chapter, for simplicity we have removed the subscript G2 and used
G instead of G2 .
First, we define,
1
|s01 i = √ |s1 i + |s2 i
2
1
|s02 i = √ |s1 i − |s2 i
(3.7)
2
11
q q
So, ht1 | s01 i = 2
N
and ht2 | s02 i = 2
N
.
So, |t⊥1 i, |t⊥2 i along with |t1 i and |t2 i forms a orthonormal basis.
Now, since |t⊥1 i is perpendicular to |t1 i and |t2 i , It1 ,t2 can not make any
change when applied on |t⊥1 i. So,
r
1 0 2
Is1 ,s2 It1 ,t2 |t⊥1 i = Is1 ,s2 q |s1 i − |t1 i
1 − N2 N
r r r r r
1 0 2 2 1 2 1
=q − |s1 i − |t1 i + 2 |s1 i + +2 |s2 i
1− N 2 N N N N N
r
1 4
0 2
=q − 1 |s1 i − |t1 i (3.10)
1− 2 N N
N
We can now find out all the matrix element of the Grover’s operator G,
in the orthonormal subspace, So,
G11 = ht⊥1 | Is1 ,s2 It1 ,t2 |t⊥1 i
1
4 2 4 r 2 r 2 2
= −1 − − −1 +
1 − N2 N N N N N N
4
= −1
N
Similarly, it is very easy to show that,
G21 = ht⊥2 | Is1 ,s2 It1 ,t2 |t⊥1 i = 0 and G41 = ht2 | Is1 ,s2 It1 ,t2 |t⊥1 i = 0.
12
Also,
r
1 2
Is1 ,s2 It1 ,t2 |t⊥2 i = Is1 ,s2 q − |s02 i
|t2 i
1 − N2 N
r
1 4
0 2
=q − 1 |s2 i − |t2 i (3.11)
1− 2 N N
N
So, G12 = ht⊥1 | Is1 ,s2 It1 ,t2 |t⊥2 i = 0 and G32 = ht1 | Is1 ,s2 It1 ,t2 |t⊥2 i = 0.
Now, similarly one can show that,
4
G22 = ht⊥2 | Is1 ,s2 It1 ,t2 |t⊥2 i = − 1,
Nr r
2 2
& G42 = ht2 | Is1 ,s2 It1 ,t2 |t⊥2 i = −2 1−
N N
Also,
h i
Is1 ,s2 It1 ,t2 |t1 i = Is1 ,s2 − |t1 i
r
h 2 0 i
= − |t1 i − 2 |s i (3.12)
N 1
So,
r r
2 2
G13 = ht⊥1 | Is1 ,s2 It1 ,t2 |t1 i = 2 1− ;
N N
4
& G33 = ht1 | Is1 ,s2 It1 ,t2 |t1 i = −1
N
13
Also,
G23 = ht⊥1 | Is1 ,s2 It1 ,t2 |t2 i = 0; & G43 = ht1 | Is1 ,s2 It1 ,t2 |t2 i = 0
qSimilarly,
q it is easy to show that G14 = G34 = 0 and G24 = −G42 =
2 N 1 − N & G44 = N4 − 1.
2 2
Now, the total matrix G in the new basis can be written as,
q q
−1 + N4 0 2 N2 1 − N2 0
q q
0 −1 + N4 0 2 N2 1 − 2
N
G≡ q q
−2 N2 1 − N2 0 −1 + N4 0
q q
0 −2 N2 1 − N2 0 −1 + N4
(3.13)
Now, since actually G = (−Is1 ,s2 It1 ,t2 ), we should write, considering the phase
factors
q q
4 2 2
1− N 0 −2 N 1 − N 0
q q
0 1 − N4 0 −2 N2 1 − N2
G≡ q q
2 2 4
2 N 1 − N 0 1− N 0
q q
0 2 N2 1 − N2 0 1 − N4
(3.14)
Which is equivalent to
cos θ 0 − sin θ 0
0 cos θ 0 − sin θ
G≡ sin θ
(3.15)
0 cos θ 0
0 sin θ 0 cos θ
q q
−1 −1
where, θ = cos (1 − N ) = sin (2 N2 1 − N2 ). Generally, N is very large,
4
so θ will be very small, for these case. The eigenvalues for this matrix G will
be e±iθ , e±iθ . So, we have got only one θ, instead of θ1 and θ2 2 . That means
2
Our expected eigenvalues was e±θ1 and e±θ2
14
the iteration is same in both the |t⊥1 i − |t1 i and |t⊥2 i − |t2 i search space.
Now, we can see that the matrix G can be analyzed by the two disjoint
matrices while the first matrix belongs to |t1 i − |t⊥1 i search space and the
other belongs to |t2 i − |t⊥2 i search space.
So, for the |t⊥1 i − |t1 i search space and |t⊥2 i − |t2 i search space, we have
G1 and G2 respectively,
cos θ − sin θ cos θ − sin θ
G1 ≡ ; G2 ≡ (3.16)
sin θ cos θ sin θ cos θ
Result
Notice that, for these case we can effectively reduce the search problem with
two initial state and two target state, to two identical canonical Grover’s
search problem with one initial state[6, 7]. Similarly, for other combinations
of hsi | tj i(except all positive or all negative), one can use a similar treatment
and can effectively reduce the problem with two Grover’s search problem[6].
15
3.2 Summary
In the analysis of the above mentioned search problem with two source
state, our result can be classified in two main category:
1. For any arbitrary combination of hsi | tj i(except all positive or all nega-
tive), we can reduce the problem into two Grover’s search problem in two
different subspace, confined by |t⊥1 i − |t1 i and |t⊥2 i − |t2 i.
2. If all the hsi | tj i are positive or negative, then the problem is nothing but
a Grover’s search problem which can be analyzed in conventional |t⊥ i − |ti
basis.
16
Chapter 4
Similar to the last case, here also, we assume each source state to be
N (= 2n ) dimensional in the 2n dimensional Hilbert space. Firstly, we are
interested in finding out the dimension of the subspace that is preserved
under the new generalized Grover’s iteration G3 for the three source states
and three target states.
Let us first take three source state to be |s1 i , |s2 i and |s3 i, that can be
generated by a similar treatment as presented in equation 3.4.
|t1 i, |t2 i , |t3 i and |j1 i, |j2 i , |j3 i are the basis states of our N dimensional
Hilbert space. Since the source states are the Walsh-Hadamard transform of
17
the elements of the search space, we must have,
1
hsi | tj i = (−1)fij √ (4.4)
N
where fij is either 0 or 1 and i, j runs from 1 to 3.
Since G3 involves 3 source state and 3 target state, we can intuitively say
that the search operator G3 must confined to at most 6 dimensional vector
space.
In this chapter, for simplicity we have removed the subscript G3 and used
G instead of G3 .
4.1.1 Analysis
18
we found that we can have at most 3 pairs of different eigenvalues in the eiθ
form and all the other eigenvalues are one. So, we can conclude that the
generalized search operator preserves at most a 6 dimensional vector space.
So, we can write G in a 6 dimensional vector space.
|s02 i = |s2 i − ht1 | s2 i |t1 i − ht2 | s2 i |t2 i − ht3 | s2 i |t3 i − ht⊥1 | s2 i |t⊥1 i
(−1)f21 (−1)f22 (−1)f23
= |s2 i − √ |t1 i − √ |t2 i − √ |t3 i
N N N
1 h i
+ q (−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23 |t⊥1 i
N 1 − N3
(4.10)
h i2
Now, hs02 | s02 i = 1− N3 1
− N 2 (1− 3
)
(−1)f11 +f21
+(−1) f12 +f22
+(−1)f13 +f23
=
N
2
a (say).
19
So, the second orthonormal basis will be,
"
1 (−1)f21 (−1)f22 (−1)f23
|t⊥2 i = |s2 i − √ |t1 i − √ |t2 i − √ |t3 i
a N N N
#
1 h i
+ q (−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23 |t⊥1 i (4.11)
3
N 1− N
|s03 i = |s3 i − ht1 | s3 i |t1 i − ht2 | s3 i |t2 i − ht3 | s3 i |t3 i − ht⊥1 | s3 i |t⊥1 i − ht⊥2 | s3 i |t⊥2 i
(4.12)
p
where b = ht⊥3 | t⊥3 i
Now, we want to find out the generalized grover operator G in the new
basis, constructed by |t⊥1 i , |t⊥2 i , |t⊥3 i and |t1 i , |t2 i , |t3 i. For, this we first
need to write the initial states |s1 i , |s2 i , |s3 i in the new orthonormal basis
and then we will find out the unitary form of the matrix G in the new or-
thonormal basis using equation 4.5.
h iT
So, the initial states in |t⊥1 i |t⊥2 i |t⊥3 i |t1 i |t2 i |t3 i basis
will be,
20
q h i
3 1 f11 +f21 f12 +f22 f13 +f23
1− N − √ (−1) + (−1) + (−1)
N 2 −3N
0
a
0 0
|s1 i = (−1)f11 ; |s i =
f
(−1) 21
√N 2 √
N
(−1)f12 (−1) f22
√ √
N N
f
(−1)f13 (−1) 23
√
√
N N
(4.13)
and
h i
− √N 21−3N (−1)f11 +f31 + (−1)f12 +f32 + (−1)f13 +f33
c
b
|s3 i = (4.14)
f
(−1) 31
√
N
(−1)f32
√
N
f
(−1) 33
√
N
where,
1 h
c=− (−1)f21 +f31 + (−1)f22 +f32 + (−1)f23 +f33
aN
N
(−1)f11 +f31 + (−1)f12 +f32 + (−1)f13 +f33
+ 2
(N − 3N )
i
(−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23
Our goal is to construct the matrix G using equation 4.5, 4.13 and 4.14.
But, it is very laborious to construct and analyze the generalized operator G
analytically for all the possible values of fij . That is why we have simulated
21
the matrix numerically for all the possible values of fij .
Since i, j runs from 1 to 3, there will be a total of 9 different fij and each
fij can have only two possible values i.e. 0 and 1. So, there will be a total
of 29 = 512 cases for different values of fij . For all the 512 cases we have
simulated the matrix G and found out the eigenvalues for each cases. We
found that,
4.2 Example
For the next part, we want to find out the no of iteration needed to search
out the target states with a significantly large probability. For that, we took
some specific examples and analyze the results.
4.2.1 Example-1
For the first example, we have chosen, f11 = 1, f12 = 0, f13 = 1, f21 =
0, f22 = 1, f23 = 0, f31 = 1, f32 = 0, f33 = 1. For this combination, we found
out that there will be 2 pairs of different eigenvalues of the matrix G, out of
them 4 are same(1, i.e. e0 ) and the other pair is (e±.023 ).
Now we have taken n = 16 i.e. the search space is 216 = 65536 dimen-
sional. We applied the search operator on the source states and want to find
out the variation of the amplitude of the target states with the number of
22
iteration. The plot of the amplitude of the target state |t2 i with the number
of iteration is shown in Figure 4.1.
Figure 4.1: The variation of amplitude of |t2 i with the number of iteration
for n = 16
So, we can see from Figure 4.1 that the amplitude is maximum(0.5774)
near the 67th iteration. Also, for target state |t1 i and |t3 i the result is exactly
same to the Figure 4.1. So, if we started with three source state, we will be
able to find out the target states with a probability of 0.57742 = 31 .
Now for n = 28 i.e. N = 228 and for n = 32 i.e. N = 232 we got Figure
4.3a and Figure 4.3b , respectively. For n = 28, we found the maximum am-
plitude(0.5774) at 4289th iteration where as for n = 32 we got the maximum
23
Figure 4.2: The variation of amplitude of |t1 i with the number of iteration
for n = 24
(a) n = 28 (b) n = 32
Figure 4.3: The variation of amplitude of target |t1 i with the number of
iteration.
24
amplitude(0.5774) near about 17000th iteration.
Notice that the maximum amplitude does not vary with the variation of
n. So, the maximum amplitude that we got after optimal iterations does not
depend on the dimension of the search space.
In the Table 4.2, we have listed the optimal no of iteration for different
n.
Now, if we plot n vs. log2 p, we got a straight line shown in Fig 4.4.
25
From the plot, we got the formula n = 2 log2 p + 3.868.
So,
√
n
−1.934 N
p=2 2 = (4.15)
21.934
4.2.2 Example-2
For the second example, we have chosen, f11 = 1, f12 = 1, f13 = 0, f21 =
0, f22 = 1, f23 = 1, f31 = 0, f32 = 0, f33 = 1 .For this combination, we have
three different pairs of eigenvalues - two complex ((e±0.7 , e±1.146 ) and one
real(1 i.e. e0 ).
Now, again, for n = 16, we want to see the variation of the amplitudes of
the target states with the number of iteration. The plot for the amplitude of
|t1 i with the number of iteration is shown in Figure 4.5.
Figure 4.5: The variation of amplitude of |t1 i with the number of iteration
for n = 16
26
So, we can see that the maximum amplitude is 0.6916 and it occurs in
the 81th iteration. Now, for the target states |t3 i, we got the same result.
But for the target state |t2 i, the variation of the amplitude of |t2 i is shown
in Figure 4.6 where the maximum amplitude is 0.9573 and it occurs in 118th
iteration.
Figure 4.6: The variation of amplitude of |t2 i with the number of iteration
for n = 16
Similarly, plotting the same graph for different n, we got the results listed
in Table 4.3.
Table 4.3: Data for optimal no of iteration for different n for the target state
|t1 i , |t1 i and |t3 i .
Plotting this data, we got the results shown in Figure 4.7a and 4.7b.
27
(a) For |t1 i & |t3 i (b) For |t2 i
Figure 4.7: The variation of amplitude of target states with the number of
iteration.
√
2n/2 N
p = 1.666 = 1.666 (4.16)
2 2√
n/2
2 N
p = 1.118 = 1.118 (4.17)
2 2
Here, for target state |t1 i & |t3 i we got Equation 4.16 and for |t2 i we got
Equation 4.17.
Notice that here also the maximum amplitude does not vary with the di-
mension of the search space. So, for the both cases, the maximum amplitude
is not a function of the dimension of the search space.
4.2.3 Example-3
For the third example, we have chosen, f11 = 1, f12 = 1, f13 = 1, f21 =
1, f22 = 1, f23 = 0, f31 = 1, f32 = 0, f33 = 1. For this combination, we have
28
two same and one different pair of eigenvalues (two e±0.8938 and e±4.46 ).
Figure 4.8: The variation of amplitude of target state with the number of
iteration for n = 16
4.2.4 Example-4
For the fourth example, we have chosen, f11 = 1, f12 = 0, f13 = 0, f21 =
1, f22 = 1, f23 = 0, f31 = 1, f32 = 1, f33 = 0 . For this combination, we have
three different pairs of eigenvalues - two complex (e±0.7 , e±1.146 ) and one real
(1 i.e. e0 ).
29
4.3 Summery
It is clear that for the three source problem, the results can be distributed
in two main category. One is for three different pairs of eigenvalues and the
other is for two different and one same pair of eigenvalue.
For every cases we have got that the maximum amplitude of the target
states is independent of the dimension of the search space. Now, for the first
case, there is only two different pairs of eigenvalue. For this we got same am-
plitude after optimal number of iteration for all the three target states. For
the first optimal no of iteration(67) we got each target states with a proba-
bility of 0.57742 ≈ 31 . By analyzing the result, we got that the probability of
√
getting the target states will be nearly equal to 1, if we repeat the process 3
times. For example, for√n = 16, we will get the the target states with almost
100% probability after 3 ∗ 67 ≈ 116 number of iteration, which is clearly in
agreement with the canonical Grover’s search algorithm’s results1 [6, 7].
For the second case, analyzing the numerical result, we got that the am-
plitude of target states |t1 i & |t2 i after the optimal number of iteration(81)
is 0.6916. So, we will get the target state with 0.69162 = 0.4783 ≈ 12 . So, we
√
have to repeat the process 2 times√to get nearly 100% probability. That
means for this we need the iteration 2 ∗ 81 ≈ 114.55 times. For the target
state |t2 i, we can see that the maximum amplitude is very near to 1 and it
occurs after 118th iteration. So, here also we found that both the results are
in agreement with the results obtained for canonical Grover’s search[6].
Since there are only two types of cases for three initial state, the result for
example-3 and example 4 are very similar to the previous cases. Example-3 is
very to example-1, since it has two same and one different pair of eigenvalues
and example-4 is also similar to example-2 since it has three different pair of
eigenvalues.
So, for each cases, we have analyzed, we found that the number of iter-
ation required to get the target states with almost 100% probability is the
same as the time taken by the canonical Grover’s search operator.
1 π 28
For canonical Grover’s algorithm, optimal number of iteration = 4 ∗ √
3
≈ 116
30
References
[3] R.P. Feynman, Feynman Lectures on Computation, Eds. A.J.G. Hey and
R.W. Allen, (Perseus Books, 1996).
[7] M.A. Nielsen and I.L. Chuang, Quantum Computation and Quantum
Information, (Cambridge University Press, 2000).
31