Search on a Hypercubic Lattice using Quantum Random Walk

advertisement
Search on a Hypercubic Lattice
using Quantum Random Walk
A Thesis
Submitted for the Degree of
MAST ER OF SCIEN CE (EN GIN EERIN G)
in the faculty of Engineering
by
Md. Aminoor Rahaman
Supercomputer Education and Research Centre
Indian Institute of Science, Bangalore
5 June 2009
Acknowledgments
First of all, I would like to express my deep sense of gratitude to my research
superviser Prof. Apoorva Patel. I profusely thank him for his technical
command, encouragement, support, guidance and very patiently correcting
my mistakes throughout the course of my research work at IISc. This research
work would not have taken its current shape without his insightful comment,
critical remark and constant feedback.
I am thankful to CSIR, Government of India, for providing me junior research
fellowship during my research work.
I would like to thank Dr. S.K. Bhattacharyya and Dr. Soumyendu Raha of
SERC for always inspiring me with their motivational talks.
My special thanks to our chairman Dr. R. Govindarajan for his support.
I thank all staff members of SERC, especially Mallika for helping me through
various administrative works.
I would like to thank Tathagat Avatar Tulsi for his valuable suggestions.
I am thankful to all my friends, especially Samir Kumar Biswas, Abhishek
Banerjee, Sandip Haldar and Ratan Joarder for their helpful suggestions,
company and emotional support.
i
Abstract
Random walks describe diffusion processes, where movement at every time
step is restricted only to neighbouring locations. Classical random walks
are constructed using the non-relativistic Laplacian evolution operator and
a coin toss instruction. In quantum theory, an alternative is to use the
relativistic Dirac operator. That necessarily introduces an internal degree
of freedom (chirality), which may be identified with the coin. The resultant
walk spreads quadratically faster than the classical one, and can be applied
to a variety of graph theoretical problems.
We study in detail the problem of spatial search, i.e. finding a marked
site on a hypercubic lattice in d-dimensions. For d = 1, the scaling behaviour
of classical and quantum spatial search is the same due to the restriction on
movement. On the other hand, the restriction on movement hardly matters
for d ≥ 3, and scaling behaviour close to Grover’s optimal algorithm (which
has no restriction on movement) can be achieved. d = 2 is the borderline
critical dimension, where infrared divergence in propagation leads to logarithmic slow down that can be minimised using clever chirality flips. In support
of these analytic expectations, we present numerical simulation results for
d = 2 to d = 9, using a lattice implementation of the Dirac operator inspired
by staggered fermions. We optimise the parameters of the algorithm, and
the simulation results demonstrate that the number of binary
√ oracle calls
N log N ) and
required
for
d
=
2
and
d
≥
3
spatial
search
problems
are
O(
√
O( N ) respectively. Moreover, with increasing d, the results approach the
optimal behaviour of Grover’s algorithm (corresponding to mean field theory
or d → ∞ limit). In particular, the d = 3 scaling behaviour is only about
25% higher than the optimal value.
ii
Contents
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
i
ii
1 Introduction
1.1 Quantum Computation . . . . . . . . . . . . . . . . . . . . . .
1.2 Grover’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Outline of the Thesis . . . . . . . . . . . . . . . . . . . . . . .
1
1
3
5
2 Known Results about Spatial Search in Different Dimensions
2.1 Dirac Equation Implementation . . . . . . . . . . . . . . . . .
2.2 Bipartite Quantum Random Walk . . . . . . . . . . . . . . . .
2.2.1 2-dim Lattice . . . . . . . . . . . . . . . . . . . . . . .
2.2.2 3-dim Lattice . . . . . . . . . . . . . . . . . . . . . . .
2.2.3 d-dim Lattice . . . . . . . . . . . . . . . . . . . . . . .
2.2.4 Eigenspectrum . . . . . . . . . . . . . . . . . . . . . .
6
8
11
12
13
14
15
3 Numerical Simulation Results for Dimension d ≥ 3
3.1 Optimisation of the Parameters s and t1 . . . . . . .
3.1.1 Analytical Criteria . . . . . . . . . . . . . . .
3.1.2 Numerical Tests . . . . . . . . . . . . . . . . .
3.2 Spatial Search: Results and Fits . . . . . . . . . . . .
3.3 Results for Multiple Marked Vertices . . . . . . . . .
16
16
17
17
24
34
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4 Numerical Simulation Results for Dimension d = 2
36
4.1 Results without Ancilla Qubit . . . . . . . . . . . . . . . . . . 38
4.2 Results with Ancilla Qubit . . . . . . . . . . . . . . . . . . . . 41
iii
CONTENTS
iv
Appendices
47
A Computer Code for 3-dim
47
B Computer Code for d-dim
53
C Computer Code for 2-dim
60
D Computer Code for 2-dim
with Ancilla Qubit
65
Bibliography
71
Chapter 1
Introduction
Computation is processing of information according to a specific set of rules.
Any set of mathematical rules have to be ultimately implemented by physical
devices. Consequently, whether a computational task can be carried out, and
if so how efficiently, depends on the physical processes implemented by the
computer hardware. In conventional classical computation, rules of Boolean
logic are implemented using electronic circuits. Quantum computation is a
recently discovered alternative paradigm, where the computational steps are
realised as dynamical evolution of quantum states. It is expected to be a
powerful computational tool, because it yields algorithms more efficient than
the classical ones by exploiting the phenomena of linear superposition and
quantum entanglement. This novel promise has made it a rapidly progressing
and a highly exciting subject to pursue [1].
1.1
Quantum Computation
In a quantum computer, the data are represented by quantum states. Quantum states are unit rays in a Hilbert space (a linear vector space with complex coefficients). We denote them as kets | i, following Dirac’s notation.
Typically, the elementary building blocks of quantum messages are qubits
(quantum bits), which are unit vectors in a two dimensional Hilbert space.
1
CHAPTER 1. INTRODUCTION
2
Qubits generalise the classical concept of bits (with possible values 0 or 1),
and we choose |0i and |1i as their orthonormal basis states. Physically qubits
are realised as states of a two-level quantum mechanical systems, e.g. up and
down spins of an electron, or ground and excited states of an atom, or horizontal and vertical polarisations of a photon. The difference between a bit
and a qubit is that whereas a bit must be either 0 or 1, a qubit can be either |0i, |1i or a normalised superposition of the two, and that is what takes
quantum computation beyond the traditional domain of Boolean logic. A
generic qubit state can be expressed as α|0i + β|1i, where α and β are complex amplitudes satisfying |α|2 + |β|2 = 1. Also, |α|2 and |β|2 respectively
are the probabilities of finding the qubit in the states |0i and |1i.
A quantum register of n qubits is a unit ray in the 2n dimensional Hilbert
space, formed as the tensor product of n two dimensional qubit spaces. The
states {|0i, |1i}⊗n are the 2n logical basis states for the quantum register,
and any register state is a linear superposition of all of them. That is why
a quantum register can in principle contain an exponentially vast amount
of information compared to a classical register. A generic register state is
entangled, i.e. it cannot be expressed as a product of individual qubit states.
Quantum algorithms perform quantum operations on the quantum registers. These operations fall in to two categories. One type is the reversible unitary
evolution of the states according to the applied Hamiltonian,
R
U = exp(−i Hdt). That takes complex amplitudes of the states from some
initial value to some final value, and can be described by the Schrödinger
equation. A sequence of unitary transformations are often represented by
a set of quantum logic gates that act on quantum registers. Application of
quantum logic gates on superposed states allows simultaneous processing of
multiple quantum messages, without any additional cost. In classical Markovian evolution (i.e. evolution where the future is determined by the present
conditions) transformation of the amplitudes is always real, while in quantum evolution it may be complex. This feature of the quantum logic has
opened up new possibilities in design of quantum algorithms.
The other type of quantum operation is the measurement process. It is an
irreversible and probabilistic step that projects the quantum state on to one
of the eigenstates of the Hermitian measurement operator. The probability
of obtaining a particular eigenstate is the absolute value squared of the corresponding amplitude component. The initial and final states of a quantum
computer are always classical, and the measurement process is essential for
connecting quantum phenomena to classical observations.
CHAPTER 1. INTRODUCTION
1.2
3
Grover’s Algorithm
The advantage of quantum computation over classical computation is that
it solves certain problems faster than known classical algorithms. A famous
example of powerful quantum computation is the quantum search algorithm
for an unstructured database [2]. A database is a collection of items that
can be distinguished from each other by certain properties, and the search
problem is to find an item having specified properties. Whether an item
picked from the database is the solution to the problem or not is recognised
by a binary oracle query. We denote the oracle by a black box function, f (x),
which returns 1 when x satisfies the specified properties and 0 otherwise. The
optimisation criterion for the search problem is to find the desired item using
the minimum number of oracle queries. Such a formulation of the problem
relative to an oracle simplifies conceptual analysis and allows easy complexity
comparison between quantum and classical algorithms. It is justified when
the oracle query is the most expensive part of the algorithm, and so reduction
of its number is the prime optimisation target.
Classically, there is nothing better one can do for an unstructured database
search than to inspect the items one by one. For a database of N items, that
is an O(N) algorithm. Grover discovered
a quantum search algorithm that
√
finds the desired item with O( N ) oracle queries—a square-root speedup
over classical search algorithms. The quantum search process uses superposition of quantum states to inspect all the items in parallel with a single
query, unlike the classical case where only one item can be inspected at a
time, to produce a faster algorithm. It has also been proved that Grover’s
algorithm is optimal, i.e. the best one can achieve with the known laws of
physics [3].
Grover’s algorithm works in an N-dimensional Hilbert space, whose basis
vectors are identified with individual items. It starts with the initial state
PN −1
|si = N −1/2 x=0
|xi, whose amplitude is uniformly distributed over all the
items. Its target state is |ti, where amplitudes of all but the desired item
vanish. The probability of obtaining the target state directly from the initial
state is |ht|si|2 = 1/N, just like the classical case. The algorithm enhances
this probability by evolving |si towards |ti along the shortest geodesic path
on the unitary sphere. It accomplishes this task by an iterative sequence of
alternating selective inversion and maximal diffusion operations. Both these
operators are reflection operators,
4
CHAPTER 1. INTRODUCTION
Rt = 1 − 2|tiht| ,
RM = 2|sihs| − 1 ,
(1.1)
and the algorithm locating the desired item with Q oracle queries is
(RM Rt )Q |si = |ti .
(1.2)
The operator Rt distinguishes the desired state from the rest. It is the binary
oracle that flips the sign of the amplitude of the desired state. The operator
RM is known as the “reflection-in-the-mean” operator. It treats all items
on an equal footing, and flips the sign of all the amplitudes relative to the
initial uniform superposition state. We can interpret the operator Rt as a
consequence of the potential energy attracting the quantum state towards
the target state, and the operator RM as a consequence of the kinetic energy
isotropically diffusing the quantum state throughout the Hilbert space [4].
The two reflection operators do not commute. As a result, each iteration
of the algorithm rotates the quantum state √
in the two-dimensional subspace
−1
formed by |si and |ti by an angle 2 sin (1/ N). The algorithm performs a
directed walk from the initial state to the target state, and when it reaches
the target state,
√
(2Q + 1) sin−1 (1/ N) = π/2 .
(1.3)
√
Asymptotically, Q = π N/4. A peculiarity of the algorithm is that if we
stop after the right number of iterations, we reach close to the target state,
else we keep on going round and round in the two-dimensional Hilbert space.
When N (and hence Q) is known, failure probability of Grover’s algorithm
can be made less than 1/N. When N is unknown and one does not know
when exactly to stop, the algorithm can still succeed with a certain overhead for quantum phase estimation [5]. In case of a database with multiple,
sayqM, target items, Grover’s algorithm finds one of the target items using
O( N/M ) oracle queries.
Grover’s algorithm is optimal because of two features: (i) it follows the
shortest path between |si and |ti, i.e. the geodesic great circle on the unitary
sphere, and (ii) it uses the largest transformations consistent with unitarity,
i.e. the reflection operations. (Note that for any projection operator, P 2 = P ,
R = 1 − 2P is a reflection operator, R2 = 1.)
The reflection operator RM used in Grover’s algorithm requires a fully
democratic transition amplitude between any two items in the database, i.e.
hi|RM |ji = 2/N for all i 6= j. Physically, a database may be distributed over
CHAPTER 1. INTRODUCTION
5
many locations, and all interactions fall off with distance. In such cases, practical transition amplitudes are restricted to be among neighbouring locations
only, and RM needs to be replaced by a different local operator. (The operator Rt implementing the binary oracle query is local and does not change.)
That is the problem of spatial search.
1.3
Outline of the Thesis
In this thesis, we study the spatial search problem using a quantum random
walk. Random walks describe diffusion processes, and are classically studied
using the Laplacian operator. In quantum computation, use of the Laplacian operator yields the same oracle query complexity as the classical one.
We have therefore studied an alternative available in quantum theory—the
relativistic Dirac operator—to achieve faster spatial search.
For ease of formulation, we assume the spatially distributed database to
be a d-dimensional hypercubic lattice. We implement the Dirac operator on
this lattice with a nearest neighbour discretisation scheme, and then carry
out numerical simulations in various dimensions to determine the complexity
of the algorithm. Chapter 2 presents the formulation of the problem together
with known results. The results of our numerical simulations for dimension
d ≥ 3 are described in Chapter 3, and we use them to infer the behaviour
of the algorithm for large d. Chapter 4 describes our numerical simulation
results for d = 2, which require special treatment due to infrared divergence.
At the end, four Appendices contain the computer codes used in our work.
Chapter 2
Known Results about Spatial
Search in Different Dimensions
Consider a spatially distributed database of N = Ld items, with the items
located at the vertices of a d-dimensional hypercubic lattice. Some of the
vertices on the lattice are marked, and the spatial search problem is to locate
them. The database can be explored by a walk on the lattice during the
search process, and we restrict the walk movements to be local, i.e. a single
step can take one from a vertex to only its 2d neighbours. This restriction
slows down the spatial search algorithms compared to Grover’s algorithm
which has no such restriction.
It is easy to understand two simple lower bounds on spatial search. One
bound arises from the fact that while the marked vertex could be anywhere
on the lattice, one step of the local walk can go from any vertex to only
its nearest neighbours. Since the marked vertex cannot be located without
reaching it, the worst case scenario on a hypercubic lattice (travelling from
one corner of the lattice to another) requires Ω(dL) steps. This bound is
the strongest in one dimension, where quantum spatial search is unable to
improve on the O(N) classical search.
The other bound follows from the fact that spatial search cannot
out√
perform Grover’s optimal algorithm, and so it must require Ω( N ) oracle
6
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
7
queries. It is independent of d, and is stronger than the first bound for d ≥ 3.
As a matter of fact, the first bound weakens with increasing d, as the number
of neighbours of a vertex increase and steps required to go from one corner
of the lattice to another decrease. In analogy with mean field theory behaviour of problems in statistical mechanics, we can thus expect that in the
d → ∞ limit the locality restriction on the walk would become irrelevant and
the complexity of spatial search would approach that of Grover’s algorithm.
(With finite N, the maximum possible dimension is log2 N.)
Combined
√ together, the two bounds make the complexity of spatial search
1/d
the borderline case of d = 2, the two bounds are of the
Ω(dN , N ). For √
same magnitude, Ω( N ). It is a familiar occurrence in statistical mechanics
of critical phenomena that interplay of different dynamical features produces
logarithmic correction factors in borderline dimensions. The same seems
to be true for spatial search in d = 2, where algorithms are slowed down
by extra logarithmic factors. It is an open question to design algorithms,
perhaps using additional parameters, that suppress the logarithmic factors
as much as possible.
Using a variety of strategies to replace the operator RM , several groups
have studied the quantum spatial search problem on hypercubic lattices in
various dimensions. The results improve over classical algorithms, and closely
follow the bounds mentioned above. Aaronson and Ambainis gave a quantum algorithm that is based on optimised recursive
√ search of subcubes [6].
It finds the marked vertex √
in the optimal time O( N) for lattices in d ≥ 3
dimensions, and in time O( N log2 N) for a two dimensional lattice. Ambainis, Kempe and Rivosh discovered a discrete time quantum algorithm that
uses a coin as an additional degree of freedom, and directs the quantum walk
according to the state of the coin [7]. Explicitly, in two dimensions, the coin
has four states and the walk is the flip-flop shift operation:
| →i ⊗ |x, yi
| ←i ⊗ |x, yi
| ↑i ⊗ |x, yi
| ↓i ⊗ |x, yi
−→
−→
−→
−→
| ←i ⊗ |x + 1, yi
| →i ⊗ |x − 1, yi
| ↓i ⊗ |x, y + 1i
| ↑i ⊗ |x, y − 1i .
(2.1)
It has been realised that this operation is equivalent to the massless Dirac
operator walk, with the coin representing
the internal spin degrees of free√
dom.
√ The algorithm runs in O( N ) time in d ≥ 3 dimensions, and in time
O( N log N) in two dimensions. Childs and Goldstone constructed a continuous time quantum algorithm using the Dirac Hamiltonian, with the spin
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
8
degrees of freedom providing extra memory in addition to the location [8]. It
matches the performance of the algorithm by Ambainis, Kempe and Rivosh,
and clarifies how the infrared divergence of the propagator in d = 2 results in
logarithmic slow down of the algorithm. Tulsi produced a quantum algorithm
where the operations are controlled using an ancilla qubit [9]. The ancilla
qubit transformations add clever chirality flips to the Dirac operator, effectively acting like a mass term that would suppress the infrared √
divergence.
That helps in two dimensions, reducing the time complexity to O( N log N ).
In this thesis, we investigate the spatial search problem using a discrete
version of the Dirac operator that does not need the extra spin degrees of freedom. Our numerical simulations determine not only the asymptotic scaling
behaviour of the algorithm but also the numerical proportionality constant
in front. We can therefore study, as a function of the number of dimensions,
how closely one can approach the optimal constant π/4 of Grover’s algorithm.
We point out that preparation of the initial uniform superposition state
|si, using local directed walk steps, is not at all difficult. For instance, one
can start at the origin, step by step transfer the amplitude to the next vertex
along an axis, and achieve an amplitude L−1/2 at all the vertices on the
axis after L steps. Thereafter, one can pick a second direction, step by step
transfer the amplitude in that direction from all the vertices on the axis, and
achieve an amplitude L−1 at all the vertices in the plane after another L steps.
Iterating the procedure for each coordinate direction produces the state |si
after dL steps in total. Clearly, this does not add to the complexity of the
algorithm, and we henceforth assume that the state |si is readily available
whenever required.
2.1
Dirac Equation Implementation
The quantum algorithmic strategy of searching for a marked vertex on a
lattice is to construct a Hamiltonian evolution, where the kinetic part of
the Hamiltonian diffuses the amplitude distribution all over the lattice while
the potential part of the Hamiltonian attracts the amplitude distribution
towards the marked vertex [4]. The optimisation criterion is to concentrate
the amplitude distribution towards the marked vertex as quickly as possible.
Grover’s algorithm uses a global operator that allows diffusion from any
vertex to any other vertex in just one step. In spatial search, we are restricted
to local operators (i.e. one can only move from a vertex to its neighbours in
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
9
one step), and we need to construct an appropriate diffusion operator that
provides fast propagation of spatial modes.
On a periodic lattice, spatial excitation modes are characterised by their
wave vectors ~k. Quantum diffusion then depends on the energy of the modes,
and is described by the evolution operator U(~k, t) = exp(−iE(~k)t). The
lowest energy mode, ~k = 0 corresponding to a uniform distribution, is an
eigenstate of the diffusion operator and does not propagate. The slowest
propagating modes are the ones with the smallest nonzero |~k|. The commonly
used classical diffusion operator is the Laplacian, which gives E(~k) ∝ |~k|2 . In
a quantum setting, there is an alternative—the Dirac operator—that gives
E(~k) ∝ |~k|. Clearly, the Dirac operator provides a faster diffusion of the
slowest modes, and it has been shown that use of the Dirac operator instead
of the Laplacian produces faster quantum spatial search algorithms.
An automatic consequence of the Dirac operator is the appearance of an
internal degree of freedom corresponding to spin, whereby the quantum state
is described by a multi-component spinor. These spinor components were
identified with the states of a coin in Refs.[7, 8], with the coin evolution rule
guiding the quantum diffusion process. While this is the correct procedure
in the continuum theory, another option is available for a lattice theory, i.e.
staggered fermions [10]. In this approach, the spinor degrees of freedom
are spread in coordinate space over an elementary hypercube, instead of
being in an internal space. As a result, location dependent signs appear in
the Hamiltonian, and translational invariance exists in steps of 2 instead of
1. We follow this approach to construct a quantum search algorithm on a
hypercubic lattice [11], reducing the total Hilbert space dimension by 2d and
eliminating the coin toss instruction.
The free particle Dirac Hamiltonian in d space dimensions is
~ + βm ,
Hfree = −i~
α·∇
(2.2)
where α
~ , β mutually anticommute and αn2 = β 2 = 1. On a hypercubic lattice,
the simplest symmetric discretisation of the gradient operator is
1
∇n f (~x) = [f (~x + n̂) − f (~x − n̂)] .
2
(2.3)
Then, by a convenient choice of basis, the anticommuting matrices α
~ , β can
be spin-diagonalised to location dependent signs:
x
d−1
· · · α2x2 α1x1 ,
ψ(~x, t) → T ψ(~x, t) , Hfree → T HfreeT † , T = αdxd αd−1
(2.4)
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
αn −→
n−1
Y
j=1
(−1)xj , β −→
d
Y
(−1)xj .
10
(2.5)
j=1
Even when the Hamiltonian H is local (i.e. has a finite range), the evolution operator U = exp(−iHt) is not (i.e. connects vertices with arbitrary
separation). To make the evolution operator local, we break up H in to blockdiagonal Hermitian parts, and then exponentiate each part separately [11].
Partitioning H in to two parts (which we label “odd” and “even”) is sufficient
for this purpose,
Hfree = Ho + He .
(2.6)
This partition is illustrated in Fig.(2.1) for d = 1 and d = 2. Each part
contains all the vertices but only half of the links attached to each vertex.
Each link is associated with a term in Hfree providing propagation along it,
and appears in only one of the two parts. The Hamiltonian is thus divided in
to a set of non-overlapping blocks that can be exponentiated exactly. Each
block is an elementary hypercube on the lattice, and the block matrices are of
size 2d × 2d in d-dimensions. The local quantum random walk on the lattice
then evolves the amplitude distribution according to
−2
(a)
(b)
−1
o
111101
0000
0000
1111
o
0000
1111
0000
1111
0000
1111
1
−1,00
−1,−1
1111
0000
000001
1111
0000
1111
o
0000
1111
0000
1111
0
e
e
e
1
o
2
e
e
0000011,1
1111
100,1
0000
1111
0000
1111
o
0000
1111
0000011,0
1111
010,0
0000
1111
100,−1
000001
1111
0000
1111
o
0000
1111
0000
1111
e
Figure 2.1: Partitioning of the hypercubic lattice into odd and even parts:
(a) for d = 1, (b) for d = 2.
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
ψ(~x; t) = W t ψ(~x; 0) , W = Ue Uo , Uo(e) = e−iHo(e) τ .
11
(2.7)
The walk operator W is translationally invariant in steps of 2, along each coordinate direction. Each block of the unitary matrices Uo(e) mixes amplitudes
of vertices belonging to a single elementary hypercube, and the amplitude
distribution spreads over the lattice because these two alternating matrices do not commute. Note that although W = exp(−iHfree τ ) + O(τ 2 ), the
truncation is such that W is exactly unitary, i.e. W = exp(−iH̃τ ).
To search for a marked vertex on the lattice, say the origin, we need to
attract the quantum walk towards it. This can be accomplished by adding a
potential to the free Hamiltonian,
V = V0 δ~x,0 .
(2.8)
Exponentiation of this potential produces a phase change for the amplitude
at the marked vertex. It is optimal to choose the magnitude of the potential
to make the phase change maximally different from 1, i.e. e−iV0 τ = −1. Then
the phase change becomes a reflection operator representing the binary oracle
query,
R0 = I − 2|~0ih~0| .
(2.9)
The quantum spatial search algorithm alternates between diffusion and
reflection operators, in analogy with Eq.(1.2), providing the evolution
ψ(~x; t2 ) = [W t1 R0 ]t2 ψ(~x; 0) .
(2.10)
Here t2 is the number of oracle queries, and t1 is the number of quantum
random walk steps between the oracle queries. Both have to be optimised,
depending on the size and dimensionality of the lattice, to find the quickest
solution to the search problem. The fastest search amounts to finding the
shortest unitary evolution path between the initial state, typically chosen as
P
the uniform superposition state |si = N −1/2 x |~xi, and the marked vertex
|~0i. This path is a geodesic arc from |si to |~0i, and so the parameters have
to be tuned such that the operator W t1 R0 approximates a rotation in the
two-dimensional |si-|~0i subspace by the largest possible angle.
2.2
Bipartite Quantum Random Walk
We now present explicit formulae, in various dimensions and with m = 0,
for the above described partition of the free Dirac Hamiltonian in to odd
12
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
and even terms. The simplest situation, though not suitable for the spatial
search problem, is in one dimension:
Ho |xi = −
He |xi =
i
ih
(−1)x |x + (−1)x i ,
2
(2.11)
i
ih
(−1)x |x − (−1)x i .
2
(2.12)
The resultant 2 × 2 blocks have the form HoB = −σ2 /2, operating on vertices
say {0, 1}. Similarly, HeB = σ2 /2, operating on vertices say {0, −1}. These
2
2
exponentiate to Uo(e) =
√cI − 2isHo(e) , where |c| + |s| = 1 and s = sin(τ /2).
The choice c = s = 1/ 2 produces an unbiased quantum walk on a line.
The expressions above can be rearranged to separate the translationally
invariant part of the walk from the location dependent signs within each local
hypercube. Let
ψ(2x, t)
Ψ(X, t) ≡
(2.13)
ψ(2x − 1, t)
describe the amplitude distribution in a two component notation. Then
W = Ũ C , C =
UoB
=
c s
−s c
, Ũ |Xi = c|Xi − s
X
±
(±σ± )|X ± 1i .
(2.14)
The operator C = UoB just mixes the components of Ψ within the hypercube.
The first term of the operator Ũ is stationary, while the other moves the
amplitude to neighbouring locations. The movement term is of flip-flop type,
a characteristic feature of the Dirac operator, because of the raising and
lowering Pauli operators σ± = (σ1 ± iσ2 )/2.
2.2.1
2-dim Lattice
Next we look at the situation for d = 2. The partitioned Hamiltonian is
Ho |x, yi = −
i
ih
(−1)x |x + (−1)x , yi + (−1)x+y |x, y + (−1)y i ,
2
(2.15)
i
ih
(−1)x |x − (−1)x , yi + (−1)x+y |x, y − (−1)y i ,
(2.16)
2
Hfree |x, yi = (Ho + He )|x, yi
(2.17)
h
i
i
= − |x + 1, yi − |x − 1, yi + (−1)x (|x, y + 1i − |x, y − 1i) .
2
He |x, yi =
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
13
More explicitly, the 4 × 4 blocks of the Hamiltonian are:
HoB = −
i
2





0 −1 −1
0
1
0
0
1
1
0
0 −1
0 −1
1
0





00
10
01
11
(2.18)
1
= − (I ⊗ σ2 + σ2 ⊗ σ3 ) ,
(2.19)
2
where the column on the right denotes the vertices of the elementary square
on which HoB operates. Similarly, HeB = −HoB , when operating on the square
with vertices {00,-10,0-1,-1-1}. Noting that Ho2 = He2 = 21 I, the blockdiagonal Hamiltonians are easily exponentiated to
√
√
Uo(e) = cI − is 2Ho(e) , |c|2 + |s|2 = 1 , s = sin(τ / 2) .
(2.20)
The parameter c (or s) can be optimised, together with t1 , to obtain the
fastest diffusion across the lattice.
We can again separate the degrees of freedom within each local hypercube
as {x, y} ≡ {X, Y }⊗{00,-10,0-1,-1-1}≡ {X, Y }⊗{0,-1}⊗2. Then the walk
operator takes the form: W = ŨC, C = UoB and
i
s Xh
((±σ± )⊗σ3 )|X ±1, Y i+(I ⊗(±σ± ))|X, Y ±1i .
Ũ|X, Y i = c|X, Y i− √
2 ±
(2.21)
2.2.2
3-dim Lattice
Next consider the situation for d = 3. The partitioned Hamiltonian is
ih
Ho |x, y, zi = − (−1)x |x + (−1)x , y, zi + (−1)x+y |x, y + (−1)y , zi
2
i
+(−1)x+y+z |x, y, z + (−1)z i ,
(2.22)
ih
He |x, y, zi =
(−1)x |x − (−1)x , y, zi + (−1)x+y |x, y − (−1)y , zi
2
i
+(−1)x+y+z |x, y, z − (−1)z i ,
(2.23)
Hfree |x, y, zi = (Ho + He )|x, y, zi
ih
= − |x + 1, y, zi − |x − 1, y, zi
2
+(−1)x (|x, y + 1, zi − |x, y − 1, zi)
i
+(−1)x+y (|x, y, z + 1i − |x, y, z − 1i) .
(2.24)
14
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
More explicitly, the 8 × 8 blocks of the Hamiltonian are:

HoB = −
i
2














0 −1 −1
0 −1
0
0
0
1
0
0
1
0
1
0
0
1
0
0 −1
0
0
1
0
0 −1
1
0
0
0
0 −1
1
0
0
0
0 −1 −1
0
0 −1
0
0
1
0
0
1
0
0 −1
0
1
0
0 −1
0
0
0
1
0 −1
1
0















000
100
010
110
001
101
011
111
1
= − (I ⊗ I ⊗ σ2 + I ⊗ σ2 ⊗ σ3 + σ2 ⊗ σ3 ⊗ σ3 ) ,
2
(2.25)
(2.26)
where the column on the right indicates the vertices of the elementary cube on
which HoB operates. Likewise, HeB = −HoB , when operating on the cube with
vertices {000,-100,0-10,-1-10,00-1,-10-1,0-1-1,-1-1-1}. With Ho2 = He2 = 43 I,
the block-diagonal matrices exponentiate to
√
2is
Uo(e) = cI − √ Ho(e) , |c|2 + |s|2 = 1 , s = sin( 3τ /2) .
3
(2.27)
Optimisation of the parameter c (or s), together with t1 , provides the fastest
diffusion across the lattice.
Again separating the degrees of freedom within each local hypercube as
{x, y, z} ≡ {X, Y, Z}⊗{0,-1}⊗3, the walk operator takes the form: W = Ũ C,
C = UoB and
s Xh
((±σ± ) ⊗ σ3 ⊗ σ3 )|X ± 1, Y, Zi (2.28)
Ũ |X, Y, Zi = c|X, Y, Zi − √
3 ±
+ (I ⊗ (±σ± ) ⊗ σ3 )|X, Y ± 1, Zi
+
2.2.3
(I ⊗ I ⊗ (±σ± ))|X, Y, Z ± 1i
i
.
d-dim Lattice
The general expressions for the partitioned Hamiltonian in d-dimensions can
now be written down explicitly. The 2d × 2d blocks of the Hamiltonian are
sums of tensor products of Pauli matrices as follows:
HoB = −
d
1X
⊗(j−1)
I ⊗(d−j) ⊗ σ2 ⊗ σ3
,
2 j=1
(2.29)
CHAPTER 2. SPATIAL SEARCH IN DIFFERENT DIMENSIONS
15
when operating on the elementary hypercube {0, 1}⊗d. Similarly, HeB = −HoB
when operating on a hypercube with the coordinates flipped in sign. The
B
d terms contributing to Ho(e)
mutually anticommute, as expected for the
Dirac Hamiltonian. The block-diagonal matrices satisfy Ho2 = He2 = d4 I, and
exponentiate to
√
2is
Uo(e) = cI − √ Ho(e) , |c|2 + |s|2 = 1 , s = sin( dτ /2) .
d
(2.30)
The parameter c (or s) is to be optimised, together with t1 , to achieve the
fastest diffusion across the lattice. Note that the d-dimensional random walk
is not the tensor product of d one-dimensional random walks.
After separating the degrees of freedom within each local hypercube as
⊗d
~
~x ≡ X⊗{0,-1}
, the walk operator takes the form: W = ŨC, C = UoB and
d
s XX
⊗(d−j) ~
~
~
Ũ|Xi = c|Xi − √
(I ⊗(j−1) ⊗ (±σ± ) ⊗ σ3
)|X ± ĵi .
d ± j=1
2.2.4
(2.31)
Eigenspectrum
√
Since Ho2 = He2 = d4 I, the eigenvalues of Ho and He are
± 2d . Moreover, Ho
√
and
He are traceless, so that half the eigenvalues are 2d , and the other half
√
√
− 2d . It follows that the eigenvalues of Uo and Ue are c±is = exp(±i dτ /2),
equally divided among complex conjugate pairs.
The unbiased initial state for the quantum spatial search problem is the
translationally invariant uniform superposition state |si. A properly designed
random walk operator should not alter it, and indeed |si is an eigenstate of
the walk operator W = Ue Uo with eigenvalue 1.
The eigenspectrum of W can be easily obtained in the continuum time
limit, τ → 0. Hfree is diagonalised by a Fourier transform, and
2
Hfree
|~xi = −
d h
d
i
X
1X
|~x + 2ĵi − 2|~xi + |~x − 2ĵi −→
sin2 (kj )|~ki .
4 j=1
j=1
qP
(2.32)
2
Up to O(τ 2 ), the eigenvalues of W = e−iHfree τ are then exp(±iτ
j sin kj ),
√ √
2
with the eigenphases in the interval [−τ d, τ d]. The average
q value of Hfree
is d/2, and the corresponding eigenvalues of W are exp(±iτ d/2).
Chapter 3
Numerical Simulation Results
for Dimension d ≥ 3
We have carried out numerical simulations of the quantum spatial search
problem on a hypercubic lattice in dimensions d = 2 to 9. In this Chapter,
we present the results for d ≥ 3 for different lattice sizes, and perform fits
to extract the asymptotic scaling behaviour. Most of our analysis is for a
single marked vertex, but at the end of the Chapter we describe some results
for multiple marked vertices. The programmes used to simulate three dimensional and d-dimensional spatial search problems are given in the Appendix A
and Appendix B respectively.
3.1
Optimisation of the Parameters s and t1
In our algorithm, we have chosen the walk operator W t1 as the evolution
operator between oracle queries, as in Eq.(2.10). It replaces Grover’s optimal
“reflection-in-the-mean” operator RM = 2|sihs| − 1. Even though W t1 is
a local operator and RM is a global operator, we can try to optimise our
algorithm by bringing the two as close as possible. To this end, we tune the
free parameters s and t1 that are part of the operator W t1 .
16
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
3.1.1
17
Analytical Criteria
The operator RM has |si as an eigenstate
with
√
√ eigenvalue 1, and the or~
thogonal combination |s⊥ i = (|si − N |0i)/ N − 1 as an eigenstate with
eigenvalue −1. |si is also an eigenstate of W with eigenvalue 1, but |s⊥ i is
not an eigenstate of W . So to obtain the best performance from our algorithm, we need to tune the parameters s and t1 , such that
(i) W t1 is as close an approximation to RM as possible, and
(ii) |s⊥ i is close to being an eigenvector of W t1 , with an eigenvalue as close
to −1 as possible.
The criterion for attaining the first condition is maximisation of the overlap between W t1 and RM ,
T r(W t1 RM ) = 2 − T r(W t1 ) = 2 −
X
i
hi|W t1 |ii .
(3.1)
hi|W t1 |ii is the amplitude for the random walk to return to the starting
state |ii after t1 time steps. Since W is translationally invariant along each
coordinate direction in steps of 2, we need to evaluate hi|W t1 |ii only for
states |ii in an elementary hypercube. Furthermore, any closed path on a
hypercubic lattice must take an even number of steps along each coordinate
direction, and all location dependent phases in our construction are just ±1
signs (cf. Eq.(2.5)). As a result, hi|W t1 |ii is independent of |ii, with all the
location dependent signs getting squared to 1. Thus our first optimisation
condition is to minimise A(t1 ) ≡ h~0|W t1 |~0i.
The criterion for attaining the second condition is to minimise (i.e. take
as close to −1 as possible)
1
hs⊥ |W t1 |s⊥ i =
(−1 + NA(t1 )) .
(3.2)
N −1
which happens to be the same as the first optimisation condition. In addition,
unitarity of the evolution operator provides the constraint
2
≤ A(t1 ) ≤ 1 .
(3.3)
|hs⊥ |W t1 |s⊥ i| ≤ 1 =⇒ − 1 +
N
3.1.2
Numerical Tests
To numerically optimise the parameters s and t1 , we considered two possibilities: (a) minimise the number of oracle queries t2 required to find the marked
vertex, and (b) maximise the probability of reaching the marked vertex. We
present below a summary of our results.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
18
Evolution of the probability distribution:
We first looked at how the probability distribution evolves as a function
of
√
time during the search process. For simplicity, we chose c = s = 1/ 2 that
corresponds to maximal mixing between even and odd vertices, and studied
the evolution as a function of t1 and t2 . In the following, we use dimension
d = 3 and lattice size L = 32 to illustrate our results.
We find that the probability at the marked vertex undergoes a cyclic
evolution pattern as a function of time t2 , analogous to what is known in
case of Grover’s algorithm. It begins with the initial value 1/N, reaches a
peak value, then decreases back close to zero and repeats the cycle. Our
results for different values of t1 and a 32 × 32 × 32 lattice are plotted in
Fig.(3.1). We observe that the probability evolution is essentially periodic for
t1 = 1, 2, 3, and persists for more than 30 cycles without any visual deviation.
Its sinusoidal nature suggests that the search operator W t1 R0 rotates the
quantum state by a fixed angle in the two-dimensional subspace formed by
the uniform superposition state and the marked state. This behaviour fully
matches with the exact solution of Grover’s algorithm. The difference among
t1 = 1, 2, 3 is that the cycle time and the peak probability vary. It means
that the projection of the quantum state undergoing rotation on to the twodimensional subspace depends on t1 .
For t1 > 3, we find that the probability evolution rapidly loses its periodic nature and the peak probability at the marked vertex plummets. The
change in the pattern is so drastic that the algorithm no longer performs a
reasonable search process. This behaviour implies that the evolution moves
the quantum state away from the two-dimensional subspace, and only a negligible component is left behind. An appropriate choice of t1 is thus crucial
for constructing a successful search algorithm.
We also studied what the probability distribution looks like at the instance when the probability at the marked vertex attains its peak value.
That is shown in Fig.(3.2) for different values of t1 . We find that the distribution is strongly peaked around the marked vertex in an essentially uniform
background. Also the peak is sharper when the peak probability is larger,
and is broader when the peak probability is smaller.
√Combining these observations, we see that for the particular choice of s =
1/ 2, the best results—the shortest period, the largest peak probability and
the sharpest peak—clearly correspond to t1 = 3. The results improve as t1
increases from 1 to 3, and deteriorate thereafter. It is an interesting fact that
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
19
all optimal features appear simultaneously at t1 = 3, which simplifies tuning
of the parameters. Table 3.1 presents our results quantitatively: P is the
first peak probability at the marked vertex and t2 is the corresponding time
(equivalently the number of oracle queries required by the search algorithm).
t1 = 1
0.08
0.06
0.04
t1 = 2
0.1
Probability
Probability
0.1
0.02
0.08
0.06
0.04
0.02
0
0
0
200 400 600 800 1000 1200 1400
0
200 400 600 800 1000 1200 1400
Time
t1 = 3
0.1
0.08
0.06
0.04
t1 = 4
0.1
Probability
Probability
Time
0.02
0.08
0.06
0.04
0.02
0
0
0
200 400 600 800 1000 1200 1400
0
200 400 600 800 1000 1200 1400
Time
0.001
Time
0.001
t1 = 5
0.0008
Probability
Probability
0.0008
t1 = 6
0.0006
0.0004
0.0002
0.0006
0.0004
0.0002
0
0
0
200 400 600 800 1000 1200 1400
Time
0
200 400 600 800 1000 1200 1400
Time
Figure 3.1: Time evolution of the probability at the marked vertex for the
quantum
√ spatial search problem on a three dimensional 32 × 32 × 32 lattice.
s = 1/ 2 and t1 is the number of walk steps between oracle queries.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
20
Probability
0.1
t
0.08
1
= 1
0.06
0.04
0.02
0
30
20
10
0
0
5
15
10
20
25
30
Probability
0.1
t
0.08
1
= 2
0.06
0.04
0.02
0
30
20
10
0
0
5
15
10
20
25
30
Probability
0.1
t
0.08
1
= 3
0.06
0.04
0.02
0
30
20
10
0
0
5
15
10
20
25
30
Probability
0.1
t
0.08
1
= 4
0.06
0.04
0.02
0
30
20
10
0
0
5
10
15
20
25
30
Figure 3.2: Probability distribution for the quantum spatial search problem on a three dimensional 32 × 32 × 32 lattice, at the instance when the
probability at the marked vertex (16, 16, 16) attains its largest value. For
convenience, we have displayed the results for the z = 16 slice.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
21
Table 3.1: Variation of peak probability and time with t1
d
L
s
3
32
√
1/ 2
t1
1
2
3
4
5
t2
118
65
55
122
82
P
0.02312
0.07046
0.10001
0.01006
0.00006
Tuning of the parameters:
Next we scanned through values of s, for different values of t1 and in different
dimensions, to obtain the optimal values at which the peak probability P
at the marked vertex is the largest and the time t2 required to reach it is
the smallest. We display our results for t1 = 3 and a 32 × 32 × 32 lattice
in Fig.(3.3). We notice that continuous P has a smoother behaviour than
discrete t2 , and maximisation of P and minimisation of t2 occur at roughly
the same value of s. So we simplify matters, and select maximsation of P
as our optimality condition. For the case displayed in Fig.(3.3), the optimal
values are: s = 0.7015, P = 0.1001 and t2 = 55.
We also studied how the optimal values change as a function of dimension.
Our results for t1 = 3 are presented in Fig.(3.4). We find that at fixed t1 ,
the shape of the P vs. s curve is almost dimension independent, and the
optimal value of s is approximately the same for all dimensions. We also
observe that for fixed s, P roughly scales as 2−d . In the staggered fermion
implementation of the Dirac operator, different vertices of an elementary
hypercube correspond to different degrees of freedom [10]. So our observation
suggests that to a large extent only the degree of freedom corresponding to
the marked vertex evolves during the search process, while other degrees
of freedom remain spectators. Moreover, the feature that the maximum
value of P approaches 2−d with increasing d implies that the efficiency of our
algorithm increases with d.
All our quantitative results are collected together in Table 3.2. In every
dimension, for each t1 , there is an optimal value of s. We note that the best
performance parameters, P and t2 , depend on d but not much on t1 or s.
(With increasing t1 , there is a slight increase in P and a small decrease in t2 ,
but that is a rather tiny improvement.)
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
22
110
100
1000 P
t2
90
80
70
60
50
40
30
0.4
0.5
0.6
s
0.7
0.8
Figure 3.3: Optimisation of s for t1 = 3 on a 32 × 32 × 32 lattice.
1
2d P
0.8
d=3
d=4
d=5
d=6
d=7
0.6
0.4
0.2
0.4
0.5
s
0.6
0.7
0.8
Figure 3.4: Optimisation of s for t1 = 3 in different dimensions. Lattice sizes
L = 32, 16, 16, 8 and 8 were used for d = 3, 4, 5, 6 and 7 respectively.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
23
Table 3.2: Optimal parameter results in different dimensions
d
L
3
32
4
16
5
16
6
8
7
8
t1
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
3
20
3
20
s
0.9507
0.7015
0.5363
0.4328
0.3637
0.3138
0.2755
0.1114
0.9541
0.6986
0.5411
0.4319
0.3618
0.3113
0.2771
0.1115
0.9500
0.6920
0.5376
0.4315
0.3615
0.3109
0.2726
0.1108
0.6891
0.1106
0.6932
0.1097
Spatial Search
t2
P
59 0.0942
55 0.1001
55 0.1016
54 0.1021
54 0.1024
54 0.1026
54 0.1027
54 0.1030
54 0.0528
54 0.0548
53 0.0553
53 0.0556
53 0.0557
53 0.0558
52 0.0558
52 0.0559
150 0.0276
148 0.0284
147 0.0286
147 0.0287
147 0.0287
147 0.0287
147 0.0288
147 0.0288
51 0.0145
51 0.0147
102 0.0073
102 0.0074
θ
3.551
3.299
3.202
3.165
3.159
3.160
3.158
3.157
3.583
3.281
3.234
3.158
3.141
3.134
3.177
3.160
3.545
3.242
3.211
3.155
3.139
3.130
3.124
3.140
3.225
3.135
3.250
3.109
s
0.9258
0.6737
0.5194
0.4208
0.3530
0.3038
0.2665
0.1074
0.9428
0.6827
0.5257
0.4256
0.3569
0.3070
0.2694
0.1084
0.9535
0.6880
0.5292
0.4283
0.3591
0.3089
0.2710
0.1092
0.6913
0.1094
0.6937
0.1098
Walk
A(t1 )min
−0.7143
−0.7618
−0.7748
−0.7803
−0.7832
−0.7849
−0.7860
−0.7890
−0.7778
−0.8190
−0.8300
−0.8347
−0.8372
−0.8386
−0.8395
−0.8420
−0.8182
−0.8541
−0.8636
−0.8676
−0.8697
−0.8710
−0.8718
−0.8739
−0.8778
−0.8951
−0.8949
−0.9102
θ
3.346
3.136
3.089
3.071
3.061
3.056
3.052
3.044
3.482
3.188
3.131
3.109
3.097
3.089
3.086
3.072
3.577
3.219
3.155
3.130
3.117
3.109
3.105
3.095
3.238
3.101
3.252
3.112
More interestingly, we find a relation between the optimal values of s and
t1 , expressed in terms of the variable
q
√
θ = 2t1 sin−1 s = t1 τ d/2 .
(3.4)
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
24
Since sin−1 s describes the unitary rotation performed by the single step operators Uo(e) , and t1 is the number of walk steps, θ is a measure of the unitary
rotation performed by the operator W t1 . For Grover’s optimal algorithm,
the corresponding unitary rotation RM is a reflection, i.e. a phase change of
π. We find that our optimal W t1 is also close to a reflection, with θ ≈ π.
Unlike the discrete −1 eigenvalue of RM though, eigenvalues of W form a
distribution. We don’t know this distribution in general, but we know it in
the limit τ → 0, as described in Subsection 2.2.4. This limit corresponds to
small s and large t1 , and Table 3.2 shows that θ indeed gets close to π in
this limit. More accurately, the normalisation of θ implies that the optimal
W t1 ≡ e−iH̃τ t1 is a reflection operator for the average eigenvalue the associated H̃ 2 . That means that all spatial modes contribute to the search process
with approximately equal strength.
Table 3.2 also lists our results for the variable A(t1 ) defined in Subsection 3.1.1, which also characterises how close W t1 is to the reflection operator
RM . We computed A(t1 ), by starting with unit amplitude at the marked vertex, and then measuring the amplitude at the marked vertex after t1 walk
steps. That is just one iteration of the algorithm, and hence checking A(t1 )
is not as elaborate a test as using the full spatial search algorithm with t2
iterations. Nevertheless, the results corroborate our optimisation of spatial
search: the minimum value of A(t1 ) is reasonably close to −1, the minimum
value occurs at approximately the same value of s (and hence θ) providing
the best special search, and the efficiency of the algorithm improves (i.e.
A(t1 ) gets closer to −1) with increasing d as well as t1 .
3.2
Spatial Search: Results and Fits
After optimising the parameters s and t1 , we performed detailed simulations
of the spatial search problem in different dimensions with different lattice
sizes. The optimal parameters depend weakly on the lattice size, while we
are interested only in the asymptotic behaviour of the algorithm. So for the
simulations,
we selected the specific parameter values: s = 0.9539 for t1 = 2,
√
s = 1/ 2 for t1 = 3 and s = 0.5410 for t1 = 4.
We investigated behaviour of the peak probability P at the marked vertex,
and the time t2 required to reach it, as a function of L and d. We then
performed simple polynomial fits to extract the asymptotic scaling of our
algorithm, first as L → ∞ for each d and then as d → ∞. We have used the
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
25
standard RMS deviation as a measure of the fitting error,
Error =
sP
n
i=1 ((yactual )i
n
− (yfitted )i )2
,
(3.5)
where n is the number of fitted data points, and (yactual )i , and (yfitted )i are the
actual and fitted values for the ith data point. We summarise our observations
and fit results in what follows.
(1) Our results for spatial search in d = 3, 4, 5 with t1 = 3 and different
lattice sizes L are displayed in Table 3.3. For each dimension, we observe that
P depends very little on L, and is consistent with approaching a constant as
L → ∞. On
√ the other hand, t2 increases with the lattice size, approximately
d/2
as L = N which is the expected scaling of the spatial search algorithm.
Table 3.3: Variation of peak probability with lattice size
s
t1
d
3
√
1/ 2
3
4
5
L
8
16
32
64
128
256
512
8
16
32
64
8
16
32
t2
7
19
55
161
452
1284
3655
13
54
214
861
26
149
846
P
0.10647
0.10298
0.10001
0.09829
0.09756
0.09721
0.09703
0.05599
0.05469
0.05443
0.05437
0.02843
0.02834
0.02832
(2) Our results for spatial search in different dimensions, with t1 = 3 and
L = 6, 8, 16, 32, are collected in Table 3.4. For fixed L, we observe that P
decreases with increasing d approximately as 2−d . As mentioned earlier, this
is a consequence of the fact in the staggered fermion implementation of the
Dirac operator, only the degree of freedom corresponding to the location of
the marked vertex on the elementary hypercube participates in the search
process. Since the number of vertices in an elementary hypercube is 2d , P
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
26
gets bounded by 2−d and the algorithm achieves that value up to a constant multiple.
q Furthermore, t2 increases with increasing d approximately as
d/2
(L/2)
= N/2d , in agreement with the effective number of vertices for
the participating degree of freedom being N/2d .
Since our values of P are less than 1, we need to augment our algorithm
by the amplitude amplification procedure [5] to find the marked vertex with
Θ(1) probability.
√ That makes the effective numberd of oracle queries for our
algorithm t2 / P . In this combination, factors of 2 arising from
√ the number
P behaves as
of
vertices
in
an
elementary
hypercube
fully
cancel,
and
t
/
2
√
N that is the expected scaling of the spatial search algorithm.
Table 3.4: Variation of peak probability with dimension
s
t1
L
6
√
1/ 2
3
8
16
32
d
3
4
5
6
7
8
9
3
4
5
6
7
8
3
4
5
6
3
4
5
t2
4
7
12
22
37
64
112
7
13
26
52
104
206
19
54
149
418
55
214
846
P
0.10545
0.05613
0.02848
0.01446
0.00731
0.00369
0.00186
0.10647
0.05599
0.02843
0.01447
0.00733
0.00370
0.10298
0.05469
0.02834
0.01447
0.10001
0.05443
0.02832
(3) Now we combine all our data for various lattice sizes L, and dimension
d varying from 3 to 9. For t1 = 3, the peak probability P at the marked vertex
is plotted in Fig.(3.5). The numerical values are fit using the functional form,
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
27
0.12
0.1
0.08
d=3
d=4
d=5
P
0.06
0.04
0.02
0
5
10
15
20
25
15
20
25
log2 N
0.016
0.014
0.012
P
0.01
d=6
d=7
d=8
d=9
0.008
0.006
0.004
0.002
0
5
10
log2 N
Figure 3.5: Peak probability at the marked vertex as a function of database
size in different dimensions. The points are the data from the simulations
and the curves are the fits P = a1 + bL1 . N ranges from 28 to 227 .
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
28
Table 3.5: Fit parameters for peak probability P = a1 +
s
t1
0.9539
2
√
1/ 2
3
0.5410
4
d
3
4
5
6
7
8
9
3
4
5
6
7
8
9
3
4
5
6
7
8
9
Lattice sizes
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
a1
0.0911
0.0522
0.0275
0.0141
0.0072
0.0036
0.0018
0.0968
0.0542
0.0283
0.0145
0.0074
0.0037
0.0019
0.0984
0.0548
0.0285
0.0146
0.0074
0.0037
0.0019
b1
0.0964
0.0100
0.0009
0.0001
−0.0004
—
—
0.0920
0.0076
0.0010
0.0001
−0.0003
—
—
0.0936
0.0087
0.0013
0.0002
−0.0003
—
—
b1
L
Error
2.43×10−5
3.02×10−5
1.70×10−6
2.31×10−7
1.40×10−6
3.50×10−6
—
2.73×10−6
1.46×10−5
4.66×10−6
5.79×10−7
1.46×10−6
3.00×10−6
—
1.84×10−5
2.24×10−5
8.05×10−6
7.67×10−7
2.86×10−6
4.50×10−6
—
b1
,
(3.6)
L
which works reasonably well. The fit parameters a1 , b1 are clearly dimension
dependent, and are listed in Table 3.5.
We do not have sufficient data at d = 8 and d = 9, to make accurate
fits or to see the asymptotic behaviour. Our analysis, therefore, relies on the
patterns seen for d = 3 to d = 7, while we use d = 8 and d = 9 values only
for consistency checks. Table 3.5 contains fit parameters for three different
optimised s − t1 pairs, and there is not much difference between them. The
slight increase seen in a1 with increasing t1 is not enough justification for
the corresponding higher running cost of the algorithm (proportional to t1 ).
So from a practical point of view, it would be best to implement our spatial
P = a1 +
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
29
search algorithm for the smallest available value of t1 , i.e. t1 = 2. (For t1 = 1,
Eq.(3.4) does not have a solution with θ ≈ π, the optimal s is very close to
1, and our algorithm does not work well there.)
Quantitatively, a1 is upper bounded by 2−d and decreases roughly as 2−d
with increasing d, as noticed before. Also b1 decreases towards zero with
increasing d, a feature also visible in Fig.(3.5), so that the smallest d = 3 has
the largest finite size corrections to the asymptotic L → ∞ behaviour.
(4) In a similar manner, we look at the behaviour of t2 for various lattice
sizes L, and dimension d varying from 3 to 9. For t1 = 3, the data are plotted
in Fig.(3.6), and are fit using the functional form,
b
t
√2 = a2 + 2 .
L
N
(3.7)
0.35
0.3
√
t2 / N
0.25
0.2
0.15
d=3
d=4
d=5
d=6
d=7
d=8
d=9
0.1
0.05
0
5
10
15
log2 N
20
25
Figure 3.6: Number of search oracle queries as a function of database size in
different dimensions. The points are the data from the simulations and the
curves are the fits √t2N = a2 + bL2 . N ranges from 28 to 227 .
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
Table 3.6: Fit parameters for search oracle queries
s
t1
0.9539
2
√
1/ 2
3
0.5410
4
d
3
4
5
6
7
8
9
3
4
5
6
7
8
9
3
4
5
6
7
8
9
Lattice sizes
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
64, 128, 256, 512
16, 32, 48, 64
12, 16, 24, 32
12, 14, 16, 18
6, 8, 10
6, 8
6
a2
0.3237
0.2167
0.1486
0.1043
0.0757
0.0509
0.0356
0.3141
0.2097
0.1470
0.1035
0.0750
0.0498
0.0353
0.3123
0.2103
0.1455
0.1015
0.0733
0.0505
0.0353
b2
0.1440
−0.0832
−0.0243
−0.0208
−0.0338
—
—
−0.0306
0.0151
−0.0300
−0.0269
−0.0296
—
—
−0.1239
−0.0500
−0.0142
0.0043
−0.0194
—
—
30
√t2
N
= a2 +
Error
4.57×10−4
1.05×10−3
2.39×10−4
1.78×10−4
2.47×10−4
7.23×10−5
—
1.23×10−3
6.71×10−4
2.12×10−4
1.88×10−4
3.39×10−4
4.55×10−5
—
8.46×10−4
3.57×10−4
2.25×10−4
6.28×10−5
2.01×10−4
4.39×10−4
—
b2
L
√
a2 / a1
1.072
0.948
0.896
0.878
0.892
0.848
0.839
1.010
0.901
0.874
0.860
0.872
0.819
0.810
0.996
0.898
0.862
0.840
0.852
0.830
0.810
Again, the fit parameters a2 and
√ b2 depend on the dimension. We see that for
a fixed database size N, t2 / N decreases with increasing dimension. This
increase in the efficiency of the algorithm with increasing d is a consequence
of the increase in the number of neighbouring vertices.
The fit parameters for three different optimised s − t1 pairs are collected
in Table 3.6. Again, there is not much difference between the a2 values for
the three sets, confirming the view that the smallest available t1 would be
best for a practical implementation of our algorithm. We also see that a2
decreases roughly as 2−d/2 with increasing d, as pointed out earlier.
The real measure of the complexity of our algorithm is the scaling of the
√
effective number of oracle queries, described by a2 / a1 . That is listed in the
last column of Table 3.6, and shows a gradual decrease with increasing d. It
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
31
√
is important to note that the value of a2 / a1 for Grover’s optimal algorithm
is π/4, and our results lie just above it. More explicitly, our results for d = 3
are about 25% above π/4, decreasing to about 10% above π/4 for d = 7.
These values imply that our algorithm improves in efficiency with increasing
d, and it is not too far from the optimal behaviour even for the smallest
dimension d = 3.
(5) To analyse the dimension dependence of our algorithm in more detail, we took the fit parameters a1 and a2 , from Table 3.5 and Table 3.6
respectively, and fit them to the functional forms,
log2 a1 = c1 + d1 d ,
(3.8)
log2 a2 = c2 + d2 d ,
d3
a2
.
√ = c3 +
a1
d
(3.9)
2
1
0
(3.10)
log2 a1
log2 a2
√
a2 / a1
−2
−4
−6
−8
−10
3
4
5
6
d
7
8
9
Figure 3.7: Behaviour of the asymptotic fit parameters as a function of dimension. The data points are from Table 3.5 and Table 3.6, with t1 = 3.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
32
Table 3.7: Fit parameters for log2 a1 vs. d
s
0.9539
√
1/ 2
0.5410
t1
2
3
4
Fitted d
3, 4, 5, 6, 7, 8
c1
−0.553
−0.458
−0.421
d1
−0.938
−0.947
−0.951
Error
4.77×10−2
4.48×10−2
3.78×10−2
Table 3.8: Fit parameters for log2 a2 vs. d
s
0.9539
√
1/ 2
0.5410
t1
2
3
4
Fitted d
3, 4, 5, 6, 7, 8
c2
−0.085
−0.138
−0.151
d2
−0.526
−0.521
−0.521
Error
2.53×10−2
2.57×10−2
2.09×10−2
√
Table 3.9: Fit parameters for a2 / a1 vs. d
s
0.9539
√
1/ 2
0.5410
t1
2
3
4
Fitted d
3, 4, 5, 6, 7, 8
c3
0.721
0.729
0.725
d3
0.995
0.791
0.761
Error
1.71×10−2
1.63×10−2
1.32×10−2
The results for t1 = 3 are displayed in Fig.(3.7), showing that the fits work
well. The fit parameters for the three different optimised s − t1 pairs are
listed in Table 3.7, Table 3.8 and Table 3.9.
The fit parameters confirm our earlier scaling observations: d1 close to
−1 means that the peak probability at the marked vertex roughly scales as
2q−d , and d2 close to −1/2 means that the search time t2 roughly scales as
N/2d . Interpreting Grover’s optimal algorithm as the d → ∞ limit of the
spatial search algorithm, we expect c3 to be close to π/4. It turns out to be
somewhat smaller, but is not very accurately determined due to the sizeable
correction from d3 . We believe that simulations for larger lattice sizes and
higher dimensions can remedy this problem.
(6) To look
√ at our data in a different manner, we have plotted all our
results for t2 / NP as a function of database size in Fig.(3.8). We observe
that for N > 215 our results lie in a narrow band between 0.82 and 0.91,
except for d = 3 results that lie a little higher. The approach of the results
towards π/4 with increasing d verifies that the complexity of our algorithm
improves with increasing d.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
33
1.1
√
t2 / N P
1
0.9
d=3
d=4
d=5
d=6
d=7
d=8
d=9
π/4
Grover
0.7
5
10
15
log2 N
20
25
√
Figure 3.8: t2 / NP as a function of database size in different dimensions.
The data are for t1 = 3, with N ranging from 28 to 227 .
1.1
√
t2 / N P
1
0.9
L=6
L=8
L=16
L=32
π/4
0.7
5
Grover
10
15
log2 N
20
25
√
Figure 3.9: t2 / NP as a function of database size for different lattice sizes.
The points are the data from Table 3.4, and the curves are the √tN2 P = al + bdl
fits. Also shown is the limiting value of Grover’s optimal algorithm.
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
34
(7) In
√ Fig.(3.9), we plot a subset of the data in Fig.(3.8), describing
how t2 / NP behaves as a function of database size for fixed lattice size
L (database size is changed by changing d). The approach to the asymptotic behaviour is particularly clear in this form, and we fit the data to the
functional form,
b
t
√ 2 = al + l .
(3.11)
d
NP
The fit parameters al √
and bl for t1 = 3 are listed in Table 3.10. With increasing database size, t2 / NP decreases towards its asymptotic value, and al is
close to π/4 when data for d > 5 are available.
It is also obvious that, for fixed N, our algorithm improves in efficiency
with decreasing L (or equivalently with increasing d). This is a consequence
of the increase in the number of neighbours of a vertex with increasing d.
An important implication is that, given a database of size N, it is best
to implement the algorithm using the smallest L (and hence the largest d)
possible. For our staggered fermion implementation of the Dirac operator,
the smallest L possible is 4. In that case, because of discrete values of t2
and small values of d, our data do not show smooth asymptotic behaviour,
and we omitted those values from our analysis. The smallest value of L we
display is therefore L = 6. We note that bl increases with increasing L, which
for large L slows down the approach of the results towards the d → ∞ value,
but we have no simple explanation of this feature.
√
Table 3.10: Fit parameters for t2 / NP vs. log2 N at fixed L
s
t1
√
1/ 2
3
L
6
8
16
32
Fitted d
4,5,6,7,8,9
4,5,6,7,8
3,4,5,6
3,4,5
al
0.819
0.803
0.773
0.724
bl
0.006
0.234
0.471
0.705
Error
1.28×10−2
3.28×10−3
6.46×10−3
3.23×10−3
In summary, for a given database size N, the most efficient parameters
for our algorithm are: t1 = 2 with s ≈ 0.95, and L = 6 with the largest d.
3.3
Results for Multiple Marked Vertices
We also carried out a few simulations of spatial search with more than one
marked vertex. The change from the single marked vertex algorithm is that
CHAPTER 3. SIMULATION RESULTS IN D ≥ 3
35
Table 3.11: Spatial search results for multiple marked vertices in d = 3
M
1
2
3
Vertex positions
(32,32,32)
(0,32,32), (32,32,32)
(0,32,33), (32,32,32)
(0,0,0), (16,16,16), (32,32,32)
(0,0,1), (16,16,16), (32,32,32)
(0,0,1), (16,16,16), (33,32,32)
P
0.09829
0.04919, 0.04919
0.09868, 0.09790
0.03530, 0.03264, 0.03082
0.09380, 0.05590, 0.04507
0.09298, 0.09838, 0.10347
t2
161
112, 112
161, 161
94, 92, 92
161, 117, 109
157, 161, 162
the binary oracle now flips the sign of amplitudes at several distinct vertices,
say M. To see clear patterns in the results, we needed to keep the marked
vertices well separated and avoid large interference effects. Our illustrative
results for peak probability P and corresponding time t2 , with t1 = 3 on a
64 × 64 × 64 lattice, are presented in Table 3.11.
Since we are using the staggered fermion implementation, it matters
whether the marked vertices belong to the same corner of the elementary
hypercube or to different corners. So we considered various hypercube positions for two and three marked vertices, and compared the results with
those for a single marked vertex. When the marked vertices are situated at
the same corner of the elementary hypercube (e.g. (0,32,32) and (32,32,32)),
they involve the same degree of freedom. In that case, we observe that the
peak probability
decreases by a factor of M and the time t2 decreases by a
√
factor of M . When the marked vertices are situated at different corners
of the elementary hypercube (e.g. (0,32,33) and (32,32,32)), they involve
different degrees of freedom. In that case, we find that there is no change
in the values of P and t2 compared to the single marked vertex case. This
pattern is also followed when some marked vertices are at the same corner
of the elementary hypercube and some at different corners.
We can infer the following equipartition rule from these observations: A
fixed peak probability (upper bounded by 2−d ) is available for each corner
degree of freedom of the elementary hypercube. Multiple marked vertices
corresponding to the same degree of freedom share this peak probability
equally, while different degrees of freedom evolve totally independent of each
other. Apart from this caveat, the dependence of time t2 on M for our spatial
search algorithm is the same as in case of Grover’s algorithm.
Chapter 4
Numerical Simulation Results
for Dimension d = 2
Finally we report the results for the quantum spatial search problem in the
borderline case d = 2. In this case, the evolution propagator arising from the
R
massless Dirac operator, d2 k/k 2 , is infrared divergent. So when we follow
the same algorithm and analysis as in Chapter 3, extra logarithmic factors
of the lattice size appear in the scaling of peak probability P and time t2 ,
and slow down the algorithm. This behaviour is in complete agreement with
the theoretical analyses of Refs.[7, 8].
Tulsi found a way to suppress the logarithmic factors by introducing in
the algorithm chirality flips controlled by an ancilla qubit [9]. The chirality
flips effectively provide a non-zero mass for the evolution propagator (i.e.
k 2 → k 2 + m2 ), and bring down the infrared divergence. Tulsi’s algorithm
works in the 2N-dimensional Hilbert space H = Ha ⊗ HN , where Ha is the
two dimensional Hilbert space of the ancilla qubit and HN is the Hilbert space
of the N vertices. The logic circuit of the algorithm evolving the quantum
state from |si to |ti is depicted in Fig.(4.1).
When Tulsi’s algorithm is applied to our specific case, the initial state is
|1i|si, and the generic operators R and W are replaced by the operators R0
and W t1 . The unitary evolution operator that is iterated t2 times is then
36
CHAPTER 4. SIMULATION RESULTS IN D = 2
37
Figure 4.1: Logic circuit for the controlled quantum spatial search algorithm.
R and W are the binary oracle and the walk operator respectively.
UC = (Z̄)a (c1 W t1 )(Xδ† )a (c1 R0 )(Xδ )a ,
(4.1)
where Xδ and Z̄ are the single qubit operators given by
Xδ =
cos δ sin δ
− sin δ cos δ
!
, Z̄ =
−1 0
0 1
!
.
(4.2)
The mutually orthogonal ancilla qubit states involved in the algorithm are,
|δ0 i = Xδ† |0i = cos δ|0i + sin δ|1i ,
|δ1 i = Xδ† |1i = − sin δ|0i + cos δ|1i .
(4.3)
The controlled binary oracle operator c1 R0 = I2N − 2|1i|~0ih1|h~0| performs
reflection about the |1i|~0i state iff the ancilla qubit is in the |1i state. Similarly, the controlled walk operator c1 W t1 performs t1 steps of the walk W iff
the ancilla qubit is in the |1i state. δ is a parameter to be tuned to obtain
the best results. The ancilla qubit becomes totally redundant for√δ = 0,
and Tulsi showed that the algorithm is optimal when cos δ = Θ(1/ log N ).
The
√ optimal algorithm finds the marked vertex with Θ(1) probability after
O( N log N) iterations of the operator UC .
In what follows, we first present our numerical results without the ancilla
qubit, and then show how they change when the controlling ancilla qubit
is added. The programmes used for our simulations without and with the
ancilla qubit are given in the Appendix C and Appendix D respectively.
CHAPTER 4. SIMULATION RESULTS IN D = 2
4.1
38
Results without Ancilla Qubit
Here we repeat the analysis of Chapter 3, but for d = 2. The summary of
our observations is presented below.
(1) For various t1 and lattice sizes, we scanned for the optimal values of
s, and our results are listed in Table 4.1. We again find that correlated s − t1
pairs simultaneously maximise the peak probability P at the marked vertex
and minimise the corresponding time t2 . Also, with increasing t1 , P increases
somewhat and t2 decreases slightly, but they are minor improvements.
Table 4.1: Optimal parameter results in d = 2
L
64
128
256
t1
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
s
0.9356
0.7015
0.5467
0.4414
0.3750
0.3228
0.2831
0.1140
0.9429
0.7226
0.5646
0.4659
0.3911
0.3405
0.2989
0.1218
0.9506
0.7444
0.5921
0.4818
0.4063
0.3486
0.3059
0.1239
t2
34
31
30
30
29
29
29
29
68
66
66
66
66
67
67
68
146
150
151
149
148
147
147
146
P
0.1309
0.1442
0.1480
0.1495
0.1503
0.1508
0.1512
0.1521
0.1144
0.1276
0.1319
0.1339
0.1351
0.1358
0.1362
0.1376
0.1011
0.1165
0.1222
0.1248
0.1261
0.1269
0.1274
0.1289
θ
3.422
3.299
3.272
3.233
3.262
3.254
3.247
3.231
3.482
3.426
3.394
3.427
3.410
3.440
3.434
3.454
3.550
3.562
3.585
3.555
3.550
3.525
3.517
3.513
CHAPTER 4. SIMULATION RESULTS IN D = 2
39
The major difference is that for fixed t1 , P decreases with increasing
lattice size and the optimal s shifts to higher value. Moreover, the variable
θ is not very close to π and increases with increasing L. This dependence on
the lattice size is a consequence of the infrared divergence. All the spatial
modes do not contribute to the search process with equal strength, and simple
averaging over them does not give the optimal values.
√
In the rest of the analysis, we stick to the parameter choice s = 1/ 2 for
t1 = 3, which is close enough to the optimal value.
(2) We plot peak probability as a function of database size in Fig.(4.2),
and fit the data using the functional form,
P log2 N = a1d +
b1d
.
log2 N
(4.4)
The fit parameters a1d and b1d are listed in Table 4.2.
2.4
2.2
2
P log2 N
d=2
1.8
1.6
1.4
1.2
1
5
10
15
log2 N
20
25
30
Figure 4.2: Peak probability at the marked vertex as a function of database
size in d = 2. We used t1 = 3, with N ranging from 26 to 228 . The curve is
the fit P log2 N = a1d + logb1dN .
2
CHAPTER 4. SIMULATION RESULTS IN D = 2
40
Table 4.2: Fit parameters for peak probability in d = 2
s
√
1/ 2
t1
3
Lattice sizes
512, 1024, 2048,
4096, 8192, 16384
a1d
b1d
Error
2.6071
-12.7648
2.42×10−3
The slowly varying logarithmic dependence is not easy to isolate; it becomes asymptotic only for rather large database size N ≥ 220 . Still we can
make out that the peak probability at the marked vertex falls off logarithmically in d = 2, in contrast to its constant behaviour for d ≥ 3.
(3) We display behaviour of t2 as a function of database size in Fig. 4.3,
and fit the data using the functional form,
t2
b2d
q
.
(4.5)
= a2d +
L
N log2 N
0.2
p
t2 / N log2 N
0.18
d=2
0.16
0.14
0.12
5
10
15
20
log2 N
25
30
Figure 4.3: Number of oracle queries as a function of database size in d = 2.
We used t1 = 3, with N ranging from 26 to 228 , and √ t2
= a2d + bL2d is
N log2 N
the fitting curve.
CHAPTER 4. SIMULATION RESULTS IN D = 2
41
Table 4.3: Fit parameters for search oracle queries in d = 2
s
√
1/ 2
t1
3
Lattice sizes
512, 1024, 2048,
4096, 8192, 16384
a2d
b2d
Error
√
a2d / a1d
0.1412
2.7546
2.25×10−3
0.0875
The fit parameters a2d and b2d are listed in Table 4.3. The data show an
oscillatory approach to the asymptotic value, and once again the logarithmic
dependence
is not easy to isolate. Nevertheless,
we can see that t2 scales
√
√
as N log N in d = 2, compared to its N scaling
√ behaviour√for d ≥ 3.
Overall, the effective number of oracle queries t2 / P scales as N log N in
√
d = 2, with a2d / a1d being the proportionality coefficient.
4.2
Results with Ancilla Qubit
Now we study the situation where our algorithm is controlled by an ancilla
qubit as per Tulsi’s prescription. We performedq
simulations
q using three
q different values of the control parameter δ: cos δ = 1/ ln N , 4/ ln N, 8/ ln N .
With small cos δ, there are too many chirality flips (the effective mass is
large), and the time evolution of propagator slows down. With large cos δ,
there are less chirality flips, and the results are expected to approach those
without the ancilla qubit. The best cos δ should be somewhere in between.
Tulsi’s theoretical analysis
did not provide the best proportionality constant
√
between cos δ and 1/ log N, and we have to figure that out numerically. The
following is the summary of our observations.
(1) For various t1 and lattice
q sizes, we scanned for the optimal values of
s, and our results for cos δ = 1/ ln N are listed in Table 4.4. As before, the
performance parameters P and t2 are simultaneously optimised by correlated
s − t1 pairs, and they show tiny improvements with increasing t1 .
But now for fixed t1 , P is roughly indepedent of the lattice size, as predicted by Tulsi and in striking contrast with the behaviour seen without
ancilla qubit. The variable θ varies a little with L and is not very close to π,
but it is more or less a constant, quite unlike its behaviour without ancilla
qubit. These features indicate that the infrared divergence of the spatial
modes is now under control, and perhaps a somewhat weighted average over
them would give optimal parameters.
CHAPTER 4. SIMULATION RESULTS IN D = 2
42
Table 4.4: Optimal parameter results with ancilla qubit in d = 2
cos δ
L
64
q
1/ ln N
128
256
t1
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
2
3
4
5
6
7
8
20
s
0.9430
0.7245
0.5575
0.4486
0.3755
0.3233
0.2837
0.1218
0.9492
0.7436
0.5776
0.4639
0.3900
0.3358
0.2935
0.1188
0.9545
0.7329
0.5678
0.4669
0.3916
0.3376
0.2954
0.1182
t2
76
75
74
74
74
74
74
75
164
165
163
163
162
162
162
161
352
350
347
347
346
345
345
345
P
0.2259
0.2298
0.2312
0.2317
0.2320
0.2321
0.2322
0.2325
0.2228
0.2286
0.2304
0.2311
0.2314
0.2316
0.2317
0.2320
0.2214
0.2280
0.2293
0.2299
0.2302
0.2303
0.2304
0.2307
θ
3.483
3.438
3.345
3.289
3.266
3.259
3.254
3.454
3.537
3.557
3.483
3.411
3.399
3.390
3.370
3.368
3.586
3.490
3.416
3.435
3.414
3.409
3.393
3.351
√
For concreteness, we again stick to the parameter choice s = 1/ 2 for
t1 = 3 for further analysis. It is quite close to the optimal value.
(2) We plot peak probability as a function of database size in Fig.(4.4),
and fit the data using the functional form,
P = a1a +
b1a
.
L
(4.6)
With increasing database size, the peak probability at the marked vertex
clearly approaches a constant value, and asymptotic corrections are O(1/L).
CHAPTER 4. SIMULATION RESULTS IN D = 2
43
0.24
0.22
P
0.2
0.18
0.16
p
1/ ln N
p
4/ ln N
p
8/ ln N
0.14
0.12
5
10
15
log2 N
20
25
Figure 4.4: Peak probability at the marked vertex as a function of database
size in d = 2, for three different values of cos δ. We used t1 = 3, with N
ranging from 26 to 226 . The curves are the fits P = a1a + bL1a .
Table 4.5: Fit parameters for peak probability in d = 2 with ancilla qubit
s
√
1/ 2
t1
3
Lattice sizes
256, 512, 1024, 2048,
4096, 8192
cos δ
1/ ln N
q
q
4/ ln N
q
8/ ln N
a1a
0.2243
b1a
0.8727
Error
2.50×10−4
0.1707
2.5361
2.47×10−4
0.1321
1.4287
1.53×10−3
This behaviour is in sharp contrast to the logarithmic fall off of P , and
O(1/ log L) asymptotic corrections, seen without ancilla qubit (cf. Eq.(4.4)).
For our staggered fermion
q implementation, P is upper bounded by 1/4, and
the results for cos δ = 1/ ln N are not far from it. With increasing cos δ,
P decreases as expected, approaching the values obtained without ancilla
qubit. The fit parameters a1a and b1a are listed in Table 4.5.
CHAPTER 4. SIMULATION RESULTS IN D = 2
44
(3) We display behaviour of t2 as a function of database size in Fig.(4.5),
and fit the data using the functional form,
t2
b2a
q
.
(4.7)
= a2a +
L
N log2 N
The fit parameters a2a and b2a are listed in Table 4.6.
0.4
p
t2 / N log2 N
0.35
0.3
0.25
p
1/ ln N
p
4/ ln N
p
8/ ln N
0.2
0.15
0.1
5
10
15
log2 N
20
25
Figure 4.5: Number of oracle queries as a function of database size in d = 2,
for three different values of cos δ. We used t1 = 3, with N ranging from 26
= a2a + bL2a .
to 226 . The curves are the fits √ t2
N log2 N
Table 4.6: Fit parameters for search oracle queries in d = 2 with ancilla qubit
s
√
1/ 2
t1
3
Lattice sizes
512, 1024,
2048, 4096,
8192
cos δ
1/ ln N
q
q
4/ ln N
q
8/ ln N
a2a
0.3463
b2a
-2.7823
Error
2.41×10−3
√
a2a / a1a
0.7312
0.2030
-8.9768
1.54×10−3
0.4913
3.2899
−3
0.4298
0.1562
3.81×10
CHAPTER 4. SIMULATION RESULTS IN D = 2
45
The logarithmic factor does not disappear from the scaling behaviour
of t2 , but the approach to the asymptotic behaviour is smoother compared
to the situation without the ancilla qubit (cf. Fig.(4.3)). As mentioned
earlier, time evolution of propagator slows down with decreasing cos δ, which
increases the search time t2 compared to the values obtained without ancilla
qubit. As
q a matter of fact, we have a bound a2a ≥ a2d , and our results for
cos δ = 8/ ln N are not far from it.
√
(4)
All
put
together,
the
effective
number
of
oracle
queries
t
/
P scales
2
√
√
as N log N , which is a log N improvement compared to the situation
without the ancilla qubit. We display its behaviour as a function of database
size in Fig.(4.6), and fit the data using the functional form,
b3a
t2
q
= a3a +
.
(4.8)
L
P N log2 N
0.8
p
t2 / P N log2 N
0.7
0.6
p
1/ ln N
p
4/ ln N
p
8/ ln N
0.5
0.4
0.3
5
10
15
log2 N
20
25
Figure 4.6: Effective number of oracle queries as a function of database size
in d = 2, for three different values of cos δ. We used t1 = 3, with N ranging
= a3a + bL3a .
from 26 to 226 . The curves are the fits √ t2
P N log2 N
CHAPTER 4. SIMULATION RESULTS IN D = 2
46
Table 4.7: Fit parameters for complexity scaling in d = 2 with ancilla qubit
s
√
1/ 2
t1
3
Lattice sizes
1024, 2048,
4096, 8192
q
q
q
cos δ
1/ ln N
a3a
0.7336
b3a
-13.0565
Error
5.31×10−3
4/ ln N
0.4911
-24.2987
4.03×10−3
8/ ln N
0.4207
31.2440
1.53×10−3
The approach to the asymptotic behaviour is oscillatory, suggesting a
second length scale (other than L) in the problem. We still obtain reasonable
fits with our ansatz, and the fit parameters a3a and b3a are listed in Table 4.7.
√
The asymptotic coefficient a3a (essentially the same as a2a / a1a ) determines
the complexity of the algorithm. Our
q results are inadequate to optimise it,
but we believe a3a ≈ 0.5 for cos δ = 4/ ln N is not far from optimal.
To summarise, the ancilla controlled spatial search algorithm has an improved scaling behaviour in d = 2, as predicted by Tulsi. The change in
asymptotic behaviour of P is a clear signal for suppression of the infrared
divergence. Asymptotic behaviour of t2 does not change, however, indicating
that some effect of infrared divergence survives. Overall, logarithmic factor
in the complexity scaling of the algorithm is reduced but not fully eliminated.
Appendix A
Computer Code for 3-dim
/*———————————————————————————————C-code for simulating the quantum spatial search problem
on the three dimensional cubic lattice
———————————————————————————————-*/
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#define L 32 // L is the Lattice size
#define c 1.0/sqrt(2.0)
#define s sqrt(1.0-c*c) // c and s are tuning parameters
#define bst c*c
#define cst c*s/sqrt(3.0)
#define tst s*s/3
float x[L][L][L];
float y[L][L][L];
float prob; /* prob is the required largest probability at the
marked vertex */
int pk; /* pk is the required number of oracle query needed to
achieve maximum probability at the marked vertex */
void CreateLattice();
void Walk();
void Peak();
47
APPENDIX A. CODE FOR 3-DIM
void
void
void
void
48
Probability(float *,int);
CheckTotalProbability();
SearchMaxProb(float *, int);
OracleAndRandomWalk(float *, int , int );
int main()
{
int t1,iter;
printf("Give number of random walk steps between
oracle calls\n");
scanf("%d",&t1);
printf("How many iteration you want\n");
scanf("%d",&iter);
float *pt;
pt=(float *)malloc(iter*sizeof(float));
unsigned seed = time(NULL);
CreateLattice(); /* Create lattice point of uniform
amplitude */
OracleAndRandomWalk(pt,t1,iter);
SearchMaxProb(pt,iter); /* Search maximum probability
at the marked vertex */
Peak();
Probability(pt,iter);
CheckTotalProbability(); /* Check total probability at
all lattice points */
printf("Time taken for simulation = %lu sec\n",
time(NULL)-seed);
free(pt);
}
void OracleAndRandomWalk(float *pt, int t1, int iter)
{
int i,j;
for(j=0;j<iter;j++)
{
x[L/2][L/2][L/2]=-x[L/2][L/2][L/2]; /* Oracle
Box flips the amplitude at the marked vertex */
for(i=0;i<t1;i++) Walk(); // Random Walk
49
APPENDIX A. CODE FOR 3-DIM
pt[j]=x[L/2][L/2][L/2]; /* Amplitude after
different iterations */
}
}
void SearchMaxProb(float *pt, int iter)
{
int i;
float pro;
prob=pt[0]*pt[0];
for(i=1;i<iter;i++)
{
pro=pt[i]*pt[i];
if(pro>prob)
{
prob=pro;
pk=i;
}
}
}
void CreateLattice()
{
int i,j,k;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
for(k=0;k<L;k++)
}
}
}
void Walk()
{
int i,j,k;
for(i=0;i<L;i++)
{
x[i][j][k]=1.0/(L*sqrt(L));
50
APPENDIX A. CODE FOR 3-DIM
for(j=0;j<L;j++)
{
for(k=0;k<L;k++)
}
y[i][j][k]=0;
}
float xa,xb,xc,xd,xe,xf,xg,xh,xi,xj,xk,xl,xm,
xn,xo,xp,xq,xr,xs,xt,xu,xv,xw,xx,xy,xz,
xza,xzb,xzc,xzd,xze,xzf,xzg;
int ip1,ip2,ip3,jp1,jp2,jp3,kp1,kp2,kp3;
for(i=0;i<=L-2;i=i+2)
{
ip1=i+1,ip2=(i+2)%L,ip3=(i+3)%L;
for(j=0;j<=L-2;j=j+2)
{
jp1=j+1,jp2=(j+2)%L,jp3=(j+3)%L;
for(k=0;k<=L-2;k=k+2)
{
kp1=k+1,kp2=(k+2)%L,kp3=(k+3)%L;
xa=x[i][jp1][kp1],xb=x[i][jp1][kp2];
xc=x[i][jp2][kp1],xd=x[i][jp2][kp2];
xe=x[ip1][j][kp1],xf=x[ip1][j][kp2];
xg=x[ip1][jp1][k],xh=x[ip1][jp1][kp1];
xi=x[ip1][jp1][kp2],xj=x[ip1][jp1][kp3];
xk=x[ip1][jp2][k],xl=x[ip1][jp2][kp1];
xm=x[ip1][jp2][kp2],xn=x[ip1][jp2][kp3];
xo=x[ip1][jp3][k],xp=x[ip1][jp3][kp1];
xq=x[ip1][jp3][kp2],xr=x[ip2][j][kp1];
xs=x[ip2][j][kp2],xt=x[ip2][jp1][k];
xu=x[ip2][jp1][kp1],xv=x[ip2][jp1][kp2];
xw=x[ip2][jp1][kp3],xx=x[ip2][jp2][k];
xy=x[ip2][jp2][kp1],xz=x[ip2][jp2][kp2];
xza=x[ip2][jp2][kp3],xzb=x[ip2][jp3][kp1];
xzc=x[ip2][jp3][kp2];
xzd=x[ip3][jp1][kp1],xze=x[ip3][jp1][kp2];
xzf=x[ip3][jp2][kp1],xzg=x[ip3][jp2][kp2];
y[ip1][jp1][kp1]+=bst*xh-cst*(xa-xe+xg-xi+xl-xu)tst*(xb-xc-xf-xj+xk-xp+xr-xt-xzd);
APPENDIX A. CODE FOR 3-DIM
51
y[ip1][jp1][kp2]+=bst*xi-cst*(xb-xf+xh-xj+xm-xv)+
tst*(xa+xd-xe+xg+xn+xq-xs-xw+xze);
y[ip1][jp2][kp1]+=bst*xl-cst*(xc-xh-xk+xm+xp-xy)tst*(xa-xd-xe+xg-xn-xq+xx-xzb-xzf);
y[ip1][jp2][kp2]+=bst*xm-cst*(xd-xi-xl+xn+xq-xz)tst*(xb+xc-xf-xj-xk+xp-xza-xzc-xzg);
y[ip2][jp1][kp1]+=bst*xu-cst*(xh+xr-xt+xv-xy-xzd)+
tst*(xa-xe+xg+xs+xw-xx+xzb-xze+xzf);
y[ip2][jp1][kp2]+=bst*xv-cst*(xi+xs-xu+xw-xz-xze)+
tst*(xb-xf-xj-xr+xt+xza+xzc+xzd+xzg);
y[ip2][jp2][kp1]+=bst*xy-cst*(xl+xu+xx-xz-xzb-xzf)+
tst*(xc-xk+xp+xr-xt+xza+xzc-xzd+xzg);
y[ip2][jp2][kp2]+=bst*xz-cst*(xm+xv+xy-xza-xzc-xzg)+
tst*(xd+xn+xq+xs+xw+xx-xzb-xze-xzf);
}
}
}
// Update the amplitude in all lattice points
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
for(k=0;k<L;k++) x[i][j][k]=y[i][j][k];
}
}
}
void CheckTotalProbability()
{
int i,j,k;
double sum=0;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
for(k=0;k<L;k++)
}
sum+=x[i][j][k]*x[i][j][k];
APPENDIX A. CODE FOR 3-DIM
}
printf("Total Probability = %lf\n",sum);
}
void Peak()
{
FILE *fp;
fp=fopen("Quan3d.dat","w");
fprintf(fp,"%d \t %lf \t %d\n",L,prob,pk);
fclose(fp);
}
void Probability(float *pt, int t2)
{
FILE *fp;
fp=fopen("Prob_3d.dat","w");
int i;
for(i=0;i<t2;i++)
{
fprintf(fp,"%d \t %lf\n",i,pt[i]*pt[i]);
}
fclose(fp);
}
52
Appendix B
Computer Code for d-dim
/*———————————————————————————————C-code for simulating the quantum spatial search problem
on the d-dimensional hypercubic lattice
———————————————————————————————-*/
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#define L 16 // L is the Lattice size
#define d 4 // d is the dimension
#define vol (int)pow(L,d)
#define dd vol*d+d
float x[vol];
float y[vol];
int dim[dd];
int len1[dd];
int len2[dd];
int sign[dd];
int scan_no;
unsigned seed;
void U_odd(double,double);
void U_even(double,double);
void CalDim();
53
54
APPENDIX B. CODE FOR D-DIM
void CalLen();
void Peak(float *,double *,int *,int);
void CheckTotalProbability();
void Scan(int , int, int);
void OracleAndRandomWalk(double ,float *, int , int , int);
void CreateLattice();
void SearchMaxProb(float *, float *,int *, int);
int MarkedVertexIndex();
int main()
{
int t1,iter,M;
M=MarkedVertexIndex(); /* Marked vertex is chosen
at x[L/2][L/2][L/2][L/2]... */
printf("Give number of random walk steps between
oracle calls\n");
scanf("%d",&t1);
printf("How many iteration you want\n");
scanf("%d",&iter);
Scan(iter,t1,M);
CheckTotalProbability(); /* Check total probability
at all lattice points */
printf("Time taken for simulation = %lu sec\n",
time(NULL)-seed);
}
int MarkedVertexIndex()
{
int i,j,tot=0;
for(i=0,j=1;i<d;i++,j*=L)
return(L*tot/2);
}
tot+=j;
void Scan(int iter, int t1, int M)
{
double c,s,tst,*scan,s_lower,s_upper; /* c and s are
tuning parameters */
float *pt,*prob;
APPENDIX B. CODE FOR D-DIM
55
int *pk;
scan=(double *)malloc(500*sizeof(double));
pt=(float *)malloc(iter*sizeof(float));
prob=(float *)malloc(100*iter*sizeof(float));
pk=(int *)malloc(100*iter*sizeof(int));
scan_no=0;
printf("Give lower and upper range of s to be scanned\n");
scanf("%lf %lf",&s_lower,&s_upper);
printf("Processing, please wait for some time\n");
seed = time(NULL);
CalDim();
CalLen();
for(s=s_lower;s<s_upper;s+=0.0002)
{
CreateLattice(); /* Create lattice point of
uniform amplitude */
OracleAndRandomWalk(s,pt,t1,iter,M);
SearchMaxProb(pt,prob,pk,iter); /* Search
maximum probability at the marked vertex */
scan[scan_no]=s;
scan_no++;
}
Peak(prob,scan,pk,scan_no);
free(scan),free(pt),free(prob),free(pk);
}
void SearchMaxProb(float *pt, float *prob, int *pk, int iter)
{
int i;
float pro;
prob[scan_no]=pt[0]*pt[0];
pk[scan_no]=0;
for(i=1;i<iter;i++)
{
pro=pt[i]*pt[i];
if(pro>prob[scan_no])
{
prob[scan_no]=pro;
APPENDIX B. CODE FOR D-DIM
56
pk[scan_no]=i;
}
}
}
void CreateLattice()
{
int i;
for(i=0;i<vol;i++)
}
x[i]=1.0/sqrt(vol);
void OracleAndRandomWalk(double s,float *pt,int t1,int iter,int M)
{
int i,j;
double c,tst;
c=sqrt(1.0-s*s);
tst=s/sqrt(d);
for(j=0;j<iter;j++)
{
x[M]=-x[M]; /* Oracle Box flips the amplitude at
the marked vertex */
for(i=0;i<t1;i++)
{
U_odd(c,tst); // Random Walk at odd site
U_even(c,tst); // Random Walk at even site
}
pt[j]=x[M]; // Amplitude after different iterations
}
}
void U_odd(double c,double tst)
{
int i,j,l,p;
for(i=0;i<vol;i++) y[i]=0;
for(l=0,j=0;l<vol;l++,j+=d)
{
for(p=0;p<d;p++) y[l]+=sign[j+p]*x[len1[j+p]];
y[l]=tst*y[l]+c*x[l];
APPENDIX B. CODE FOR D-DIM
57
}
// Update the amplitude in all lattice points
for(i=0;i<vol;i++) x[i]=y[i];
}
void U_even(double c,double tst)
{
int i,j,l,p;
for(i=0;i<vol;i++) y[i]=0;
for(l=0,j=0;l<vol;l++,j+=d)
{
for(p=0;p<d;p++) y[l]-=sign[j+p]*x[len2[j+p]];
y[l]=tst*y[l]+c*x[l];
}
// Update the amplitude in all lattice points
for(i=0;i<vol;i++) x[i]=y[i];
}
void CalLen()
{
int j,l,vsub,p,power,t;
for(l=0,j=0;l<vol;l++,j+=d)
{
power=0;
vsub=vol;
for(p=0;p<d;p++)
{
power+=dim[j+p];
power=power%2;
sign[j+p]=1-2*power;
vsub=vsub/L;
len1[j+p]=l+vsub*(1-2*(dim[j+p]%2));
if(dim[j+p]==0)
t=L;
APPENDIX B. CODE FOR D-DIM
58
else if (dim[j+p]==L-1)
t=-L;
else
t=0;
len2[j+p]=l+vsub*(t-1+2*(dim[j+p]%2));
}
}
}
void CalDim()
{
int i,j,k,r,p;
for(i=0,j=0;i<vol;i++,j+=d)
{
for(p=0;p<d;p++) dim[j+p]=0;
}
for(i=1,j=d;i<vol;i++,j+=d)
{
for(k=1;k<d;k++) dim[j+d-1-k]=dim[j-1-k];
dim[j+d-1]=i%L;
r=L;
p=0;
while(i%r==0)
{
dim[j+d-2-p]=(dim[j+d-2-p]+1)%L;
r*=L;
p++;
}
}
}
void CheckTotalProbability()
{
int i;
double sum=0;
for(i=0;i<vol;i++) sum+=x[i]*x[i];
printf("Total Probability = %lf\n",sum);
APPENDIX B. CODE FOR D-DIM
}
void Peak(float *prob,double *scan,int *pk, int t2)
{
FILE *fp;
fp=fopen("QuanNd.dat","w");
int j;
for(j=0;j<t2;j++)
{
fprintf(fp,"%d \t %lf \t %d \t %lf\n",
L,scan[j],pk[j],prob[j]);
}
fclose(fp);
}
59
Appendix C
Computer Code for 2-dim
/*———————————————————————————————C-code for simulating the quantum spatial search problem
on the two dimensional square lattice
———————————————————————————————-*/
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#define L 128 // L is the Lattice size
int scan_no;
unsigned seed;;
double x[L][L];
double y[L][L];
void Peak(double *,double *,int *, int);
void CheckTotalProbability();
void Scan(int ,int);
void OracleAndRandomWalk(double ,double *,int,int);
void CreateLattice();
void SearchMaxProb(double *,double *,int *,int);
void Walk(double,double,double);
int main()
{
60
APPENDIX C. CODE FOR 2-DIM
61
int t1,iter;
printf("Give number of random walk steps between
oracle calls\n");
scanf("%d",&t1);
printf("How many iteration you want\n");
scanf("%d",&iter);
Scan(iter,t1);
CheckTotalProbability(); /* Check total probability
at all lattice points */
printf("Time taken for simulation = %lu sec\n",
time(NULL)-seed);
}
void CheckTotalProbability()
{
int i,j;
double sum=0;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++) sum+=x[i][j]*x[i][j];
}
printf("Total Probability = %lf\n",sum);
}
void Scan(int iter, int t1)
{
double c,s,tst,*pt,*prob,*scan,s_lower,s_upper;
/* c and s are tuning parameters */
int *pk;
pt=(double *)malloc(iter*sizeof(double));
prob=(double *)malloc(100*iter*sizeof(double));
pk=(int *)malloc(100*iter*sizeof(int));
scan=(double *)malloc(100*iter*sizeof(double));
scan_no=0;
printf("Give lower and upper range of s to be scanned\n");
scanf("%lf %lf",&s_lower,&s_upper);
printf("Processing, please wait for some time\n");
seed = time(NULL);
APPENDIX C. CODE FOR 2-DIM
for(s=s_lower;s<s_upper;s+=0.0002)
{
CreateLattice();
OracleAndRandomWalk(s,pt,t1,iter);
SearchMaxProb(pt,prob,pk,iter); /* Search
maximum probability at the marked vertex */
scan[scan_no]=s;
scan_no++;
}
Peak(prob,scan,pk,scan_no);
free(scan),free(pt),free(prob),free(pk);
}
void OracleAndRandomWalk(double s,double *pt,int t1,int iter)
{
int i,j;
double c,bst,cst,tst;
c=sqrt(1.0-s*s);
bst=c*c;
cst=(c*s)/sqrt(2.0);
tst=s*s/2.0;
for(j=0;j<iter;j++)
{
x[L/2][L/2]=-x[L/2][L/2];
for(i=0;i<t1;i++) Walk(bst,cst,tst);
pt[j]=x[L/2][L/2];
}
}
void SearchMaxProb(double *pt,double *prob,int *pk,int iter)
{
int i;
double pro;
prob[scan_no]=pt[0]*pt[0];
pk[scan_no]=0;
for(i=1;i<iter;i++)
{
pro=pt[i]*pt[i];
62
63
APPENDIX C. CODE FOR 2-DIM
if(pro>prob[scan_no])
{
prob[scan_no]=pro;
pk[scan_no]=i;
}
}
}
void CreateLattice()
{
int i,j;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
}
}
x[i][j]=1.0/L;
void Walk(double bst,double cst,double tst)
{
int i,j,ip1,ip2,ip3,jp1,jp2,jp3;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++) y[i][j]=0;
}
float xa,xb,xc,xd,xe,xf,xg,xh,xi,xj,xk,xl;
for(i=0;i<=L-2;i=i+2)
{
ip1=i+1;
(i==L-2)?(ip2=0,ip3=1):(ip2=i+2,ip3=i+3);
for(j=0;j<=L-2;j=j+2)
{
jp1=j+1,jp2=(j+2)%L,jp3=(j+3)%L;
xa=x[i][jp1],xb=x[i][jp2],xc=x[ip1][j];
xd=x[ip1][jp1],xe=x[ip1][jp2],xf=x[ip1][jp3];
xg=x[ip2][j],xh=x[ip2][jp1],xi=x[ip2][jp2];
xj=x[ip2][jp3],xk=x[ip3][jp1],xl=x[ip3][jp2];
y[ip1][jp1]+=bst*xd-cst*(xa-xc+xe-xh)+tst*(xb+xf-xg+xk);
y[ip1][jp2]+=bst*xe-cst*(xb-xd+xf-xi)+tst*(-xa+xc+xj+xl);
APPENDIX C. CODE FOR 2-DIM
64
y[ip2][jp1]+=bst*xh-cst*(xd+xg-xi-xk)+tst*(xa-xc+xl+xj);
y[ip2][jp2]+=bst*xi-cst*(xe+xh-xj-xl)+tst*(xb+xf-xk+xg);
}
}
for(i=0;i<L;i++)
{
for(j=0;j<L;j++) x[i][j]=y[i][j];
}
}
void Peak(double *prob,double *scan, int *pk,int t2)
{
FILE *fp;
fp=fopen("Quan2d.dat","w");
int j;
for(j=0;j<t2;j++)
{
fprintf(fp,"%d \t %lf \t %d \t %lf\n",
L,scan[j],pk[j],prob[j]);
}
fclose(fp);
}
Appendix D
Computer Code for 2-dim
with Ancilla Qubit
/*———————————————————————————————C-code for simulating the ancilla controlled quantum spatial
search problem on the two dimensional square lattice
———————————————————————————————-*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
#define L 256
#define Cos sqrt(1.0/log(L*L))
#define Sin sqrt(1.0-Cos*Cos)
int scan_no;
unsigned seed;;
double x[L][L][2];
double y[L][L][2];
void Peak(double *,double *,int *, int);
void CheckTotalProbability();
void Scan(int ,int);
void OracleAndRandomWalk(double ,double *,int,int);
void CreateLattice();
void SearchMaxProb(double *,double *,int *,int);
65
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
void
void
void
void
66
Walk(double ,double ,double);
Ancilla_1();
Ancilla_2();
Ancilla_3();
int main()
{
int t1,iter;
printf("Give number of random walk steps between
oracle calls\n");
scanf("%d",&t1);
printf("How many iteration you want\n");
scanf("%d",&iter);
Scan(iter,t1);
CheckTotalProbability(); /* Check total probability
at all lattice points */
printf("Time taken for simulation = %lu sec\n",
time(NULL)-seed);
}
void CheckTotalProbability()
{
int i,j;
double sum=0;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
sum+=x[i][j][0]*x[i][j][0]+x[i][j][1]*x[i][j][1];
}
printf("Total Probability = %lf\n",sum);
}
void Scan(int iter, int t1)
{
double c,s,tst,*pt,*prob,*scan,s_lower,s_upper;
/* c and s are tuning parameters */
int *pk;
pt=(double *)malloc(iter*sizeof(double));
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
67
prob=(double *)malloc(100*iter*sizeof(double));
pk=(int *)malloc(100*iter*sizeof(int));
scan=(double *)malloc(100*iter*sizeof(double));
scan_no=0;
printf("Give lower and upper range of s to be scanned\n");
scanf("%lf %lf",&s_lower,&s_upper);
printf("Processing, please wait for some time\n");
seed = time(NULL);
for(s=s_lower;s<s_upper;s+=0.0002)
{
CreateLattice();
OracleAndRandomWalk(s,pt,t1,iter);
SearchMaxProb(pt,prob,pk,iter); /* Search
maximum probability at the marked vertex */
scan[scan_no]=s;
scan_no++;
}
Peak(prob,scan,pk,scan_no);
free(scan),free(pt),free(prob),free(pk);
}
void OracleAndRandomWalk(double s,double *pt,int t1,int iter)
{
int i,j;
double c,bst,cst,tst;
c=sqrt(1.0-s*s);
bst=c*c;
cst=(c*s)/(sqrt(2.0));
tst=s*s/2.0;
for(j=0;j<iter;j++)
{
Ancilla_1();
x[L/2][L/2][1]=-x[L/2][L/2][1];
Ancilla_2();
for(i=0;i<t1;i++) Walk(bst,cst,tst);
Ancilla_3();
pt[j]=x[L/2][L/2][0]*x[L/2][L/2][0]
+x[L/2][L/2][1]*x[L/2][L/2][1];
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
}
}
void SearchMaxProb(double *pt,double *prob,int *pk,int iter)
{
int i;
double pro;
prob[scan_no]=pt[0];
pk[scan_no]=0;
for(i=1;i<iter;i++)
{
pro=pt[i];
if(pro>prob[scan_no])
{
prob[scan_no]=pro;
pk[scan_no]=i;
}
}
}
void CreateLattice()
{
int i,j;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
x[i][j][0]=0;
x[i][j][1]=1.0/L;
}
}
}
void Walk(double bst,double cst,double tst)
{
int i,j,ip1,ip2,ip3,jp1,jp2,jp3;
for(i=0;i<L;i++)
{
68
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
for(j=0;j<L;j++)
69
y[i][j][1]=0;
}
float xa,xb,xc,xd,xe,xf,xg,xh,xi,xj,xk,xl;
for(i=0;i<=L-2;i=i+2)
{
ip1=i+1;
(i==L-2)?(ip2=0,ip3=1):(ip2=i+2,ip3=i+3);
for(j=0;j<=L-2;j=j+2)
{
jp1=j+1,jp2=(j+2)%L,jp3=(j+3)%L;
xa=x[i][jp1][1],xb=x[i][jp2][1],xc=x[ip1][j][1];
xd=x[ip1][jp1][1],xe=x[ip1][jp2][1],xf=x[ip1][jp3][1];
xg=x[ip2][j][1],xh=x[ip2][jp1][1],xi=x[ip2][jp2][1];
xj=x[ip2][jp3][1],xk=x[ip3][jp1][1],xl=x[ip3][jp2][1];
y[ip1][jp1][1]+=bst*xd-cst*(xa-xc+xe-xh)+tst*(xb+xf-xg+xk);
y[ip1][jp2][1]+=bst*xe-cst*(xb-xd+xf-xi)+tst*(-xa+xc+xj+xl);
y[ip2][jp1][1]+=bst*xh-cst*(xd+xg-xi-xk)+tst*(xa-xc+xl+xj);
y[ip2][jp2][1]+=bst*xi-cst*(xe+xh-xj-xl)+tst*(xb+xf-xk+xg);
}
}
for(i=0;i<L;i++)
{
for(j=0;j<L;j++) x[i][j][1]=y[i][j][1];
}
}
void Ancilla_1()
{
int i,j;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
y[i][j][0]=0;
y[i][j][1]=0;
}
}
for(i=0;i<L;i++)
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
70
{
for(j=0;j<L;j++)
{
y[i][j][0]=Cos*x[i][j][0]-Sin*x[i][j][1];
y[i][j][1]=Sin*x[i][j][0]+Cos*x[i][j][1];
}
}
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
x[i][j][0]=y[i][j][0];
x[i][j][1]=y[i][j][1];
}
}
}
void Ancilla_2()
{
int i,j;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
y[i][j][0]=0;
y[i][j][1]=0;
}
}
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
{
y[i][j][0]=Cos*x[i][j][0]+Sin*x[i][j][1];
y[i][j][1]=-Sin*x[i][j][0]+Cos*x[i][j][1];
}
}
for(i=0;i<L;i++)
{
APPENDIX D. CODE FOR 2-DIM WITH ANCILLA QUBIT
for(j=0;j<L;j++)
{
x[i][j][0]=y[i][j][0];
x[i][j][1]=y[i][j][1];
}
}
}
void Ancilla_3()
{
int i,j;
for(i=0;i<L;i++)
{
for(j=0;j<L;j++)
}
}
x[i][j][0]=-x[i][j][0];
void Peak(double *prob,double *scan, int *pk,int t2)
{
FILE *fp;
fp=fopen("Quan2d_ancilla.dat","w");
int j;
for(j=0;j<t2;j++)
{
fprintf(fp,"%d \t %lf \t %d \t %lf\n",
L,scan[j],pk[j],prob[j]);
}
fclose(fp);
}
71
Bibliography
[1] M. Nielsen and I. Chuang, Quantum Computation and Quantum Information (Cambridge University Press, Cambridge, 2000),
http://www.squint.org/qci/.
[2] L. Grover, in Proc. of the 28th Annual ACM symposium on theory of
computing (Philadelphia, ACM Press, 1996), p.212,
arXiv:quant-ph/0605043.
[3] C. Zalka, Phys. Rev. A 60 (1999) 2746, arXiv:quant-ph/9711070.
[4] L. Grover, Pramana 56 (2001) 333, arXiv:quant-ph/0109116.
[5] G. Brassard, P. Hoyer, M. Mosca, and A. Tapp, in Quantum Computation and Information, eds. S. Lomonaco and H. Brandt (AMS, Providence, 2002), p.53, arXiv:quant-ph/0005055.
[6] S. Aaronson and A. Ambainis, in Proc. of the 44th IEEE Symposium
on Foundations of Computer Science (IEEE Press, Los Alamitos, 2003),
p.200, arXiv:quant-ph/0303041.
[7] A. Ambainis, J. Kempe and A. Rivosh, in Proc. of the ACM-SIAM
SODA’05 (ACM Press, New York, 2005), p.1099,
arXiv:quant-ph/0402107.
[8] A. Childs and J. Goldstone, Phys. Rev. A 70 (2004) 042312,
arXiv:quant-ph/0405120.
[9] A. Tulsi, Phys. Rev. A 78 (2008) 012310, arXiv:0801.0497.
[10] L. Susskind, Phys. Rev. D 16 (1977) 3031,
http://prola.aps.org/abstract/PRD/v16/i10/p3031.
72
BIBLIOGRAPHY
73
[11] A. Patel, K. Raghunathan and P. Rungta, in Proc. of QICC 2005 (IIT
Kharagpur, Allied Publishers, 2006), p.41, arXiv:quant-ph/0506221.
Download