single qubit gate simulation for quantum computer

28
Contents 1. ABSTRACT............................................... 1 2. INTRODUCTION...........................................2 2.1 POWER OF QUANTUM COMPUTERS........................................4 2.2 BITS TO QUBITS.................................................... 4 3. THE BASIS OF QUANTUM COMPUTING.........................6 3.1 Matrix representation of state....................................6 4. CLLASICAL GATES.................................................... 7 4.1 NOT GATE........................................................ 7 4.2 AND GATE........................................................ 7 4.3 NAND GATE....................................................... 8 4.4 OR GATE......................................................... 8 4.5 NOR GATE:....................................................... 8 4.6 XOR GATE:....................................................... 9 4.7 LOGIC DESIGN USING GATES........................................9 5. QUANTUM GATES.........................................10 5.1 Quantum Not Gate.................................................10 5.2 Quantum Z Gate................................................... 11 5.3 Hadamard Gate.................................................... 11 5.4 COMBINATION OF QUANTUM GATES.........................12 6. PROGRAMMING IN C #....................................12 Department of Physics Government College University Lahore

Upload: zoro840

Post on 18-Nov-2014

164 views

Category:

Documents


2 download

DESCRIPTION

this thesis is about the qubit gate simulation by using visual studio 8 in c sharp language

TRANSCRIPT

Page 1: Single Qubit Gate Simulation for quantum computer

Contents

1. ABSTRACT....................................................................................................................1

2. INTRODUCTION.........................................................................................................2

2.1 POWER OF QUANTUM COMPUTERS..............................................................................................4

2.2 BITS TO QUBITS....................................................................................................................................4

3. THE BASIS OF QUANTUM COMPUTING.............................................................6

3.1 Matrix representation of state.................................................................................................................6

4. CLLASICAL GATES................................................................................................................................74.1 NOT GATE..........................................................................................................................................74.2 AND GATE..........................................................................................................................................74.3 NAND GATE.......................................................................................................................................84.4 OR GATE.............................................................................................................................................84.5 NOR GATE:.........................................................................................................................................84.6 XOR GATE:.........................................................................................................................................94.7 LOGIC DESIGN USING GATES.....................................................................................................9

5. QUANTUM GATES....................................................................................................10

5.1 Quantum Not Gate.................................................................................................................................10

5.2 Quantum Z Gate.....................................................................................................................................11

5.3 Hadamard Gate......................................................................................................................................11

5.4 COMBINATION OF QUANTUM GATES............................................................12

6. PROGRAMMING IN C #...........................................................................................12

7. SINGLE QUBIT SIMULATOR.................................................................................13

7.1 How to run the simulator.......................................................................................................................13

7.2 List of the forms......................................................................................................................................14

Department of PhysicsGovernment College University Lahore

Page 2: Single Qubit Gate Simulation for quantum computer

7.2.1 Main Form.......................................................................................................................................15

7.2.2 X Gate Form........................................................................................................................................16

7.2.3 Z Gate...................................................................................................................................................17

7.2.4 Hadamard Gate...................................................................................................................................17

8 CONCLUSION.............................................................................................................19

9 BIBLIOGRAPHY.........................................................................................................20

Department of PhysicsGovernment College University Lahore

Page 3: Single Qubit Gate Simulation for quantum computer

1. ABSTRACT

This thesis gives brief but main idea of the field of quantum computation along with the

techniques that can be used to do quantum computation. As this field has mainly three

parts namely; Quantum Physics, Mathematics and Computer Science. This is the basic

reason that this subject is very difficult to understand and its concepts.

At beginning I will give the brief background of the computer science, mathematics and

physics related to this field, which is necessary to understand that how computation takes

place and how to manipulate the quantum information. Then I will introduce the idea of

qubit which is counterpart of bit.

Many simulators have been made in different programs and have been tested. For

example QCAD, but I have built this single qubit simulator in Visual Studio 8. As this

simulation is designed for single qubit so it cannot be used for multi qubit simulation

unless modification made in it.

Department of Physics 1Government College University Lahore

Page 4: Single Qubit Gate Simulation for quantum computer

2. INTRODUCTION

In every field of life we are using computers such as calculations, internet, for business,

education, military purposes and much more even we can safely say that in every field of

life. With the passage of time it’s becoming clear that the computers we are using today

have less capacity even the fastest and most powerful computers. The problem is not so

much that microprocessors are too slow; but computers are inherently inefficient. The

reason behind it is the programs on which basis modern computers works. First they

divide the task into basic operations, which are then carried out serially, one operation at

a time. However computer designers tried their best to tackle this problem by placing two

microprocessors parallel to work on different aspects of a problem at the same time, but

the progress is still nil. Ordinary computers sometimes appear to us doing many tasks at a

time, such as playing music and running word-processor, but in reality the

microprocessor is working serially from one task to another very quickly. [1]

A real parallel computer must have simultaneity built into its very nature. It must be able

to do many tasks at once. Such computers do exist. They are called quantum computes.

They operate according to the bizarre rules of quantum mechanics, which do relate to the

world of the very small: the subatomic particles and the waves relating to them.

The field of quantum computing is based upon three pillars named as quantum

mechanics, computer science and mathematics of complex numbers. Computer

technology has developed in many years which bring changes from one type of physical

realization to another – from gears to relays to valves to transistors, integrated circuits

and so on. Today we have the advanced techniques such as lithography by which we can

etch logic gates and wires having size less than a micron onto the surface of silicon chips.

And still there is capacity to further squeeze the technology which will consist of only a

few atoms each. What will happen if we reach at atomic level? Obviously our whole

setup will collapse and this technology will be failed at atomic level. Now what we have

to do? Story does not end here but shows us a new technology i.e. Quantum Computers

Department of Physics 2Government College University Lahore

Page 5: Single Qubit Gate Simulation for quantum computer

do computation using atomic particles. In quantum computing we use the spin of atomic

particles up and down as zero and one in logic gates.

The purpose of making simulation for quantum circuits is to check their output and

behavior. These simulations are also a powerful tool to implement the few available

quantum algorithms such as Shor’s factoring algorithm and Grover’s search algorithm.

Simulating quantum systems obviously is a difficult task because classical computers

have difficulty simulating large quantum circuits. The reason for this difficulty is that

number to describe complex numbers for quantum system grows exponentially with the

size of the quantum system.

Department of Physics 3Government College University Lahore

Page 6: Single Qubit Gate Simulation for quantum computer

2.1 POWER OF QUANTUM COMPUTERS

If a traditional computer were given the task of looking up a person’s address or phone

number in a telephone book, it would go serially and go through each name in order until

it found the matching number which we have given to find out. Obviously computers can

search faster than a person, it is again sequential working. A quantum computer could

look at all phone numbers and names available in the phone book simultaneously. Also

quantum computers can communicate with each other instantaneously even at large

distances even across the solar systems.

2.2 BITS TO QUBITS

The classical computers stores data in the machine language which is binary. 0s and 1s

are used to store information what type of information it may be.

The left figure shows the bits, combination of 1s and 0s to store data. While the right

figure shows the qubits, state of the electrons or any other atomic particle. [2]

Department of Physics 4Government College University Lahore

Figure 1 bits and qubits

Page 7: Single Qubit Gate Simulation for quantum computer

3. The BASIS OF QUANTUM COMPUTING

A classical computer has a memory made up of bits, where each bit represents either a

one or a zero, and the all logic operations are made on these two logic levels. Quantum

computer also uses one and zero for computing but this one and zero comes from the spin

state of the atomic particle. Down spin is taken as zero and up spin as one. A quantum

computer maintains a sequence of qubits. The word qubit comes from the combination of

the tow words quantum and bit. This means quantum bit or simply qubit. A single qubit

can represent a one, a zero, or, crucially, any quantum superposition of these; moreover, a

pair of qubits can be in any quantum superposition of 4 states, and three qubits in any

superposition of 8. In general a quantum computer with ‘n’ qubits can be in an arbitrary

superposition of up to 2n different states simultaneously (this compares to a normal

computer that can only be in one of these 2n states at any one time). A quantum computer

operates by manipulating those qubits with a fixed sequence of quantum logic gates. The

sequence of gates to be applied is called a quantum algorithm. [3]

Qubit is an elementary object for quantum computing which stores information. Qubit is

a vector in a two-dimensional complex vector space. In this vector space a vector has two

components and its projections are complex numbers. Dirac’s notations are used to

represent the state function ψ of the particle with α and β complex numbers and with |0>

and |1> two vectors. |1> represents the up spin and |0> represents spin down. [4]

3.1 Matrix representation of state

The state vectors i.e. |0> for down spin and |1> for up spin can be represented by the

matrix as given below.

|1> = 01

|0> = 10

Department of Physics 5Government College University Lahore

Page 8: Single Qubit Gate Simulation for quantum computer

4. CLLASICAL GATES

Logic gates are made up of transistors. 5 volts of transistor logically represents 1 and 0

volts logically represents 0. The combination of transistors makes different types of logic

gates which are used to perform logic operations.

Basically six types of logic gates are used to perform Boolean operation on binary

numbers. Boolean operation includes AND, OR, NOT, NAND, NOR, and XOR

operation. These logic gates work on the principle 0 and 1 logic or may be called true or

false and to change the states from 0 to 1 and from 1 to 0. The truth table of each of the

gate along with its symbol to express it is given below.

4.1 NOT GATEIt inverts the given output.

4.2 AND GATEIt gives only output 1 when both its inputs are at 1.

Department of Physics 6Government College University Lahore

Figure 2 Not Gate

Page 9: Single Qubit Gate Simulation for quantum computer

4.3 NAND GATEIts output will be 0 only when both inputs are 1, otherwise all outputs are 1

4.4 OR GATEIts output is 1 when one of its inputs is at 1. If both inputs are 0 then

output will be 1.

4.5 NOR GATE:This gate is a combination of two gates NOT and OR it simply inverts the

outputs of the OR gate.

Department of Physics 7Government College University Lahore

Figure 3 AND Gate

Figure 4 NAND Gate

Figure 5 OR Gate

Page 10: Single Qubit Gate Simulation for quantum computer

4.6 XOR GATE:Its output is 0 when both inputs are equal otherwise output is 1.

4.7 LOGIC DESIGN USING GATESTo add two binary numbers we have a simple logic

design. The addition of two binary numbers results in four possible outputs, as given below. When we add 1+1 we get 0 with a carry to the next higher place. This column matches the above output for the XOR function, and the carry column matches the output for the AND function. Similarly for other operations we can use other combination of the gates.

Figure 8 Two implementations of a Half-Adder

This is a brief description of the logic gates that we are using in today computers to do computation. All the calculations are being done by combination of these gates. [5] Department of Physics 8

Government College University Lahore

Figure 6 NOR Gate

Figure 7 XOR Gate

Carry Sum

0 + 0 = 0 00 + 1 = 0 11 + 0 = 0 11 +1 = 1 0

Page 11: Single Qubit Gate Simulation for quantum computer

5. QUANTUM GATES

In classical computers electrical wires and circuits of logic gates are used to perform

calculations. Similarly, a quantum computer consists of quantum circuits containing

wires and elementary quantum gates to do the quantum computation. Very important

property of quantum gates is that they are reversible unlike classical gates. It means that

output can be converted back to input. For this backward conversion it is necessary that

number of outputs must be equal to the number of inputs.

5.1 Quantum Not Gate

The quantum NOT gate for qubits can be defined as that takes the state |0> to the sate |1>

and vice versa and the quantum analogue for the NOT gate. This gate is defined as by

matrix as:

X=[ 01¿1 0]

Department of Physics 9Government College University Lahore

Figure 9 Quantum NOT GateInput Output

|0> |1>|1> |0>

α|0>+β|1> α|1>+β|0>

Page 12: Single Qubit Gate Simulation for quantum computer

5.2 Quantum Z Gate

This gate is defined by the matrix as:

Z=[ 1 00−1]

It don’t change the state |0> and invert the sign of the state |1> to give -|1>.

Truth table for Z gate is

5.3 Hadamard Gate

The Hadmard gate can be represented by the matrix as:

H= 1

√2 [ 1 11−1]

Department of Physics 10Government College University Lahore

Figure 10 Quantum Z Gate

Input Output

|0> |o>|1> -|1>

α|0>+β|1> α|0>-β|1>

Page 13: Single Qubit Gate Simulation for quantum computer

The Hadmard gate takes the state |0> and converts it into ¿¿ , which is considered mid-

way between |0> and |1>. It means it changes the state into the superposition state. [6]

The truth table of Hadmard gate is as:

5.4 Combination of Quantum GatesAs we can perform different operations with the combination of logic gates, such as

addition. Similarly combining quantum gates we can also perform such type of

operations.

6. Programming In C #

C# inherits its most of the programming syntax from the two world’s most famous and

most successful computer languages: C and C++. It is also very similar to another

language Java. So in order to understand C# the basic knowledge of C or C++ is good but

not necessary because it is separately a complete language. [7]

Department of Physics 11Government College University Lahore

Figure 11 Quantum Hadamard Gate

Input Output

|0> ¿¿

|1> ¿¿

α|0>+β|1>¿α ¿¿

¿

Page 14: Single Qubit Gate Simulation for quantum computer

7. Single Qubit SimulatorI have built the single qubit simulator. This is made in the Microsoft Visual Studio 8. The

language used to program these gates is C# named as C-Sharp. In order to run this single

qubit Microsoft Visual Studio 8 is required. Next I will show by figures that how to

interact with this simulator and that how to perform operations by Quantum gates. In

visual studio we work in forms. Forms are different windows.

The figure below shows the code for the main form in right side of the figure list of all

forms that are linked with the main form is also shown.

Visual Studio 8

7.1 How to run the simulatorFirst click the file Q gate as shown in above figure when next window opens then press

F5 to run the simulator. At a time one form can be opened to simulate a gate.

Department of Physics 12Government College University Lahore

Figure 12 Visual Studio Preview

Page 15: Single Qubit Gate Simulation for quantum computer

7.2 List of the forms1. Main Form ( linked with all other forms )

2. Z Gate Form

3. X Gate Form

4. Hadamard Gate Form

Source code of main form

The figure below shows the source code of the main form opened in Visual Studio 8.

Source code of X Gate

The figure below shows the source code of the X gate form.

Department of Physics 13Government College University Lahore

Figure 13 Source code for main form

Figure 14 Source Code for X Gate

Page 16: Single Qubit Gate Simulation for quantum computer

7.2.1 Main FormIt consists of the menu bar which has linked with all other forms. In order to jump from

main form to other gates forms go to menu ‘Quantum Gates’ then select the desired form.

Figure below showing the simulator preview after pressing the F5.

Department of Physics 14Government College University Lahore

List of the forms

Main Form

Menu Bar

Figure 15

Figure 16

Page 17: Single Qubit Gate Simulation for quantum computer

7.2.2 X Gate Form To jump to the X gate form click on the quantum gate in menu bar then select X gate. It

will open another form which contain X gate. Now we can give values in the given boxes

and can get the desired result i.e. X gate will invert the given state. The figure below

shows the step to open the X gate form.

This figure shows the X gate form preview. If we select the first radio button and then

press the simulate button along with giving value in the box left of the X gate then X gate

will invert the value giving result in the box right side of it. Similarly if we have selected

the second radio button then second X gate will be operational.

Department of Physics 15Government College University Lahore

Simulate button

Radio buttons

Figure 17

Figure 18

Page 18: Single Qubit Gate Simulation for quantum computer

7.2.3 Z GateSame procedure may be adopted to open the Z gate form. This is also listed in the

quantum gates menu. Also to select the different gate similar to X gate radio buttons are

also here.

7.2.4 Hadamard GateOn the same steps Hadamard gate simulator can be run and tested for single qubit as this

simulation is designed for single qubit, thus it does not support to handle qubit more than

one qubit.

Department of Physics 16Government College University Lahore

Figure 19

Figure 20

Page 19: Single Qubit Gate Simulation for quantum computer

Department of Physics 17Government College University Lahore

Page 20: Single Qubit Gate Simulation for quantum computer

8 ConclusionI have built simulation for a single qubit. It can be tested for single qubit input.

Simulations have been made before also but this one is more user friendly and can be run

easily. Also this simulation can be modified to make it useful for multi-qubit gates.

Department of Physics 18Government College University Lahore

Page 21: Single Qubit Gate Simulation for quantum computer

9 Bibliography

1. Mazidi, Mazidi, Makinlay. The 8051 Microcontroller and embedded systems. Second Edition

2. http://news.uns.purdue.edu/x/2008a/080626KlimeckArsenic.html

3. http://library.thinkquest.org/07aug/01632/qgatessave.pdf

4. Shani, Vishal. Quantum Computing, Tata McGraw-Hill Publishing Company Limited 2007

5. http://en.wikipedia.org/wiki/Quantum_computing

6. Fitzgerald, Damien. Quantum Qudit Simulation. Masters Thesis, MSC Software Design and Development, National University of Ireland Galway

7. Rasheed, Faraz. Programmer’s Heaven C# School First Edition 2006

Department of Physics 19Government College University Lahore