Вы находитесь на странице: 1из 7

Quantum Algorithm

Bowei Zhao
October 20, 2014
Proposition (Deutsch 1985) Let U be unitary matrix on a d-dimensional
space. Then the action of U can be written as a product of 2d
2
d unitary
matrices, each of which acts within a two-dimensional subspace dened by
a xed set of d basis vectors. Thus any unitary transformation on n qubits
can be realized by a sequence of unitary operations, each of which aects no
more than two qubits.
Proof : Let u
1
, ...u
d
denote d orthonormal eigenvectors of U, where
1
, ...
d
are the eigenvalues.
u
1
= (x
1
, ..., x
d
), then
A
12
= (
1

|x
1
|
2
+|x
2
|
2

x
1
x
2
x
2
x
1

, I
3,...,n
)
operates as a 2x2 matrix on the rst two coordinates and maps u
1
to
(t
2
, 0, x
3
, ...x
d
), where t
2
= sort|x
1
|
2
+|x
2
|
2
. a goal of d-1 such maps A
1k
will produce (1,0,...,0).
Multiply this by the eigenvalue
1
= e
i
1
and apply the inverses of A
1k
s
in reverse order has the eect of multiplying the rst eigenvector u
1
by the
rst eigenvalue
1
in 2d-1 one- and two- dimensional unitary operations.
Since these vectors are orthogonal, the other eigenvectors are mapped to
and then from a vector with a zero in the rst component and are thus
unaected by the procedure. Repeat for each eigenvector, and U can be
thus unitarily factored.
A logic gate is a computing machine whose input and output consist of
xed numbers of bits and which prefers a xed computation in a xed time
that is independent of the input.
Quantum gate is, an analog of a logic gate in a classical computer, which
are basic units of quantum algorithms.
A quantum gate has to be implemented unitary and must be reversible.
The Tooli gate:
1
000 001 010 011 100 101 110111

1 0 0 0 0 0 0 0 000
0 1 0 0 0 0 0 0 001
0 0 1 0 0 0 0 0 010
0 0 0 1 0 0 0 0 011
0 0 0 0 1 0 0 0 100
0 0 0 0 0 1 0 0 101
0 0 0 0 0 0 0 1 110
0 0 0 0 0 0 1 0 111
It applies a NOT to the third bit if the rst two bits are in 11, but
otherwise does nothing. It is known to be universal for reversible Boolean
logic.
Two-bit gates are not sucient for reversible Boolean logic. Two-bits
NAD gate cannot be made reversible without the introduction of a third
bit. If we are to retain one of the input bits in the output, and produce the
NAND of the two inputs in the second output bit, it will give the following
truth table:
a
1
a
2
a
1
a
1
a
2
0 0 0 1
0 1 0 1
1 0 1 1
1 1 1 0
The gate is still irreversible since two dierent inputs can be taken to
the same output. To make it reversible, we have to use both of the input
bits, and a third bit to save the output, as what is done in the Tooli gate.
The Tooli gate cannot be classically decomposed into two two-bit C-
NOTs or XORs, but a quantum decomposition is possible.
Quantum Logic
A quit is a quantum state, and as such can be in a superposition state
also. That is, in addition to |0 and |1, a quantum qubit can exist more
generally in the sate c
0
|0 + c
1
|1, where c
0
and c
1
are complex coecients
normalized to 1. So though it has discrete eigenstates, it can take on a
continuous range of superposition states.
The measurement collapse also applies, as measurement will always nd
a quit in one of its two eigenstates, |0 or |1.
Unlike classical bits, two or more qubits can interfere with one another,
forming a coherent superposition, of the form c
00
|00 + c
01
|01 + c
10
|10 +
2
c
11
|11. Generally n qubits will have 2
n
product eigenstates, or dimensions,
in their Hilbert spaces.
While a classical nat is able to represent products of a superposition
state of two qubits, of the form [c
0
|0
1
+ c
1
|1
1
][c

0
|0
2
+ c

1
|1
2
], it cannot
fully represent entangled states like
1

2
[|01 +|10].
Now we have the basic memory unit of a quantum computer, we can
study what makes the quantum computation itself. In classical reversible
computing, the types of function computed are reversible Boolean functions,
where number of inputs and outputs are always equal. A quantum compu-
tation has to be unitary. A prototypical example is quantum time evolution,
where the Hamiltonian describing the quantum system is exponentiated to
produce a unitary operator: U(t
f
, t
i
) = exp[i

t
i
t
f
H(t)dt]
Since U

= U
1
, quantum computing is reversible. All Boolean functions
are special cases of unitary transformations. We can do so by taking the
transpose or hermitian adjoint of the unitary matrix.
The read-out process is quantum mechanical measurement that collapses
the system to an eigenstate. This process is irreversible. Therefore a quan-
tum algorithm with classical inputs has to nd a way to evolve these inputs
into near-classical outputs again for ecient read-out, even thought the in-
termediate sate of the system would be unclassical (See Shors algorithm).
Quantum Gates
Quantum gates must be unitary: The transformation of inputs of outputs
must be unitary because the circuit must cause the quantum state to evolve
in accordance with Schr odinger

s equation.
U
not
=

0 1
1 0

U
XOR
=

1 0 0 0 |00
0 1 0 0 |01
0 0 0 1 |10
0 0 1 0 |11
Unlike the classical logic gates, these quantum gates are also able to
transform superposition states.
The Walsh-Hadamaard transform
U
WH
=
1

1 1
1 1

maps the eigenstate |1 to 2

1
2
[|0 |1]
3
The Deutsch gate operates on three qubits at a time,
D() =

1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 i cos sin
0 0 0 0 0 0 sin() i cos

It has the property D()D(

) = iD( +

), so can be xed as an
irrational multiple of . D(/2) = T
3
.
The Deutsch gate is universal for quantum logic in the sense that any
unitary transform on an arbitrary number of qubits can be simulated by
repeated application of D() on three qubits at a time.
But Deutsch gate is not elementary, since it is later discovered that
Deutsch gate can be further decomposed into two-qubit gates.
The Tooli gate, which cannot be constructed from two-bit XOR gates,
can be simulated using only two-qubit gates.
A general way of writing a 2-dimensional unitary matrix, except for an
overall-phase factor, is
y(, , ) =

cos e
iv
sin
e
i()
sin e
i
cos

A family of universal two-bit gates can be built using y.

2
[y] =

1 0 0 0
0 1 0 0
0 0 cos e
iv
sin
0 0 e
i()
sin e
i
cos

The set of gates,


2
[y(, , )], is universal for quantum logic in the sense
that any uniform transform, on any number of qubits, can be simulated by
these gates acting on only two qubits at a time.
Performing a Quantum computation
Basic steps
1. Choose the computation we want to perform.
2. Represent as a circuit of quantum gates
3. Compute the Hamiltonian H that achieve the circuit.
4. Compute the unitary evolution operation.
5. Determine the size of the memory register.
6. Initialize the memory register (input to the circuit).
7. Evolve the computer.
4
8. Read cursor qubits to determine whether the computation is complete.
9. If so, read the answer qubit. If not continue computation.
10. Bundle the previous steps into full simulator function.
Well take a computation that is quantum as an example, that is what
we call the

NOT. This is a computation, just like what it seems to be,


such that

NOT

NOT NOT.
Once we have a particular computation in mind, we need to design a
quantum circuit to achieve it. We need to know what quantum gates we are
going to use and how to wire them together. There is no actual wire, but
the wiring is simply to specify which output feeds into which input.
Well dene the action of the

NOT gate as follows:

NOT

1+i
2
1i
2
1i
2
1+i
2

It can be easily checked that this is unitary:

NOT (

NOT)

1+i
2
1i
2
1i
2
1+i
2

1i
2
1+i
2
1+i
2
1i
2

1 0
0 1

And that two

NOT gates has the same eect as one NOT gate:

NOT

NOT =

1+i
2
1i
2
1i
2
1+i
2

1+i
2
1i
2
1i
2
1+i
2

0 1
1 0

One single

NOT gate, however, will take the classical |0 and |1 states


into the superposition state c
0
|0 +c
1
|1.
|0 (
1+i
2
|0 +
1i
2
|1);
|0 (
1i
2
|0 +
1+i
2
|1).
The

NOT gate is an inherently quantum computation, and can be


used in true random number generation.
Determining the size of the memory register:
One set of particles is used to record the position of the cursor (how many
steps the computation is performed), and the other set of the particles is used
to record the answer (or a superposition of the cursor). If the computation
requires the application of k logical gates to some input pattern of m qubits,
then there will be k+1 qubits devoted to monitoring the cursor position and
m qubits devoted to representing the answer. So we need a total of m+k+1
qubits to simulate the whole computer.
For a

NOT

NOT circuit, m = 1, k = 2, so m + k + 1 = 4 and we


can represent the whole computer with a 2
4
1 dimensional column vector.
Forming a

NOT gate that works on more than one qubit:

NOT[4, 4]

NOT.
Computation of the Hamiltonian operator
5
For a time-independent Hamiltonian

H, the Schrodingers equation takes
the form:
ih
|(t)
t
=

H |(t).
The solution of Schrodingers equation:
|(t) = e
i

Ht
h
|(0) =

U(t)|(0).
This implies, in time t the initial state of the memory register |(0)
evolves into the state of |(t) under the operator

U(t) = e
i

Ht
h
. So |(t)
is the output from the circuit at time t.
So we need to nd a time-independent Hamiltonian operator

H such
that, when insured into the matrix exponential, exp(i

Ht/h) results in a
unitary matrix

U(t) that mimics the action of our desired circuit.
To move the cursor forwards and backwards we need a creation and an
annihilation operator. We rst annihilate the cursor at the i
th
site and then
recreate it at the (i + 1)
th
site. So the term for moving the cursor from the
i
th
site to the (i +1)
th
site and coupling it to the application of the (i +1)
th
gate operation is
c
i+1
a
i


M
i+1
.
The creation operator c acting on a single spin state is
c =

0 0
1 1

The annihilation operator a acting on a single spin state is


a =

0 1
0 1

Versions of creation and annihilation operators can be created that act


on the i
th
of four qubits using the tensor product with identity matrices at
the dead positions that we described earlier. For example, the creation
operator that acts on the second of four bits is given by
c
2
=

1 0
0 1

0 0
1 0

1 0
0 1

1 0
0 1

The Hamiltonian operator is

H =

k1
i=0
c
i+1
a
i


M
i+1
+ (c
i
+ 1 a
i


M
i+1
)

.
Now the evolution operator

U(t) is

U(t) = (e
i

H/h
)
t
.
Application
Shors Algorithm
1. Choose n s.t. N
2
S = 2
n
< 2N
2
.
Choose y s.t. gcd(y, N) = 1.
2. initialize two n-qubit registers to state 0: |
0
= |0|0.
6
3. Randomize the rst n domain qubits:
|
0
|
1
=
S1

k=0
1

S
|k|0
4. Evaluate the function f(k) y
k
mod(N):
|
1
|
2
=
S1

k=0
1

S
|k|f(k).
5. Transform the rst n quits using nite Fourier transform F = F
S
,
which maps
|k
1

S
S1

u=0
exp
2iuk
S
|u.
and is implementable unitarily and feasibly: |
2
|
3
=
1
S
S1

u=0
|f(k) exp
2iuk
S
.
6. Since y is a periodic function, say, r-periodic, f is r-periodic. Let
k = m + jr, where 0 m < r and 0 j < A, A =
S
r
and f(k) can be
written as f(m). Then the nal state can be expressed as
|
3
=
S1

u=0
r1

m=0
b
u
exp
2iuk
S
|u|f(m), where b
u
=
1
S
1exp
2iurA
S
1exp
2iur
S
.
7. Measure the rst integer, obtaining as before a value u with proba-
bility

3
|P
u
|
3
= rb
u
2
8. Use u and S to deduce a value of r.
r is odd then return to 2.
r = 2s, y
s
1mod(N), return to 2.
Otherwise use the Euclidean algorithm to compute (N, y
s
1). If bigger
than 1, quit. Otherwise return to 2.
References
Muthukrishnan, Ashok. Classical and Quantum Logic Gates: An Intro-
duction to Quantum Computing Quantum Information Seminar. (1999).
Pittenger, Arthur O. An Introduction to Quantum Computing Algo-
rithms. Boston: Birkhuser, 1999. Print.
Williams, Colin P., and Scott H. Clearwater. Explorations in Quantum
Computing. Santa Clara, CA: TELOS, 1998. Print.
7

Вам также может понравиться