Quantum: How to build homemade Quantum Computer?



Era of quantum computing has began in 1980s when the first useful algorithms were proposed. The most known of them is Shor's algorithm invented in 1994 by Peter Shor. It is designed to quickly factorise large numbers which means finding two numbers which when multiplied together give the original. It may sound like another feature for simple calculator but in fact the most popular and widespread cryptography method RSA is based on the difficulty of factoring large numbers (here created by multiplication of two prime numbers). Breaking RSA 140 (where large number has 140 digits) would take longer than the age of the universe if classical computers would be used. For quantum computer running Shor's algorithm it is a matter of seconds.

Even if algorithms were already there the quantum computer itself was still far from physical implementation. This was caused mostly by the difficulty of creating quantum state that lives long enough to be efficiently used.

Quantum computer calculates on qubits - quantum equivalent of classical bits. The difference between them is that one bit can be equal either to 1 or 0 where qubit is equal to 0 and 1 in the same time. Then two bits can have states: 00, 01, 10 or 11. Two qubits have all four states in the same time. Moreover qubits can entangle with each other which leads to such non-classical possibilities like quantum teleportation (which is in fact just teleportation of information - not a physical particle).

Among last years scientists have experimented with different materials that can be used to bulid qubits. Reading briefly Wikipedia's "Timeline of quantum computing" we can find:
  • 1998 - 3 qubits - qubit is made from nuclear magnetic resonance
  • 2000 - 7 qubits - qubit is made from nuclear magnetic resonance
  • 2005 - 8 qubits - qubit is made from calcium atom in ion trap
  • 2006 - 12 qubits - qubit is made from nuclear magnetic resonance
  • 2007 - 28 qubits - qubit is made from quantum annealing
  • 2008 - 128 qubits - qubit is made from quantum annealing
  • 2012 - 300 qubits - qubit is made from beryllium ions in a Penning Trap
  • 2015 - 1000 qubits - qubit is made from quantum annealing
  • 2017 - 2000 qubits - qubit is made from quantum annealing
Note should be made that mentioned above quantum annealing can perform only a part of quantum computing and for example cannot run Shor's algorithm.

Not only quantity is important. Over those years many experiments where conducted on other potential qubit materials like photons, different types of atoms and ions, electrons, graphene and other molecules. Also lifetime was tested not only from the computing point of view but also for storing and transfering data.

Big companies also goes with the flow. Google has jumped to this train in 2009. Last year IBM annouced its quantum computer, Intel its quantum microchip and Microsoft its quantum programming language integrated with Visual Studio and operating on quantum simulator running on Azure.

There are more examples of progress but that's not what you would like to read here, right? You are here to learn how to build a homemade quantum computer.

OK, so we start with the Complex numbers. Each Complex number is composed of one real number and one imaginary number. For both we will use floating-point arithmetic.

We need to prepare basic operations for them: addition, substration and multiplication. Division operation won't be needed. However negation operator could come handy. One last thing we need is magnitude (also called absolute value) of Complex number. Done.

Next step is to put those Complex numbers into Matrix. If you don't have Matrix that can contain Complex numbers (and usually that is the case) you need to create your own. Once again we won't need all operations of Matrices. Here we just need to be able to Swap Rows of Matrix and Multiply two Matrices.

Now we come to the point when we will start using word "quantum". Take one of Matrices you have created before. Make sure that it has only one column. We will name it "Quantum Register". For each n qubits in our quantum computer we will need 2n rows of "Quantum Register".

Take another Matrix, this time with the same quantity of columns and rows (remember that n qubits requires 2n rows and 2n columns) and name it "Quantum Gate". We need to define different types of gates. For basic quantum computations we will use set of 3 Pauli gates (gate X, gate Y and gate Z), Hadamard gate, Square Root NOT gate and Phase Shift gate. All of them are one-qubit gates so everytime when user will choose to use one of them we will have to modify our "Quantum Gate" matrix. This can be done by tensor multiplication of several one-qubit matrices. In this tensor multiplication we use our gate for our qubit and one-qubit Identity matrices for other qubits. We will also need two-qubit gate called Swap gate which just uses Swap Rows of Matrix for a given qubit.

Alright, now we have everything we need to build a simple Quantum Computer. The central processing unit of this computer will be called "Quantum Circuit" (it owes its name from electrical circuits). "Quantum Circuit" requires at least two "Quantum Registers" (initial and final) and one "Quantum Gate". The circuit itself is built from qubits. Initial quantum state of those qubits is stored in initial "Quantum Register".

Gates acts on qubits and thus are changing their quantum states. We can create map of those influence by drawing something like music sheet where each tone of sound is one qubit and gates are like music notes. Like when playing music we play note-by-note we will now modify our circuit's "Quantum Gate" by multiplicating it by each "Quantum Gate" of individual gates. Just take caution for control qubits which are limiting range of individual gate to just the rows for which control qubit is 1.
Each note in music sheet is describing properties of sound tone.

Each gate in quantum circuit is describing operator that acts on qubit.

After processing through all gates our circuit's "Quantum Gate" matrix will become super gate. By multiplicaing it now by initial "Quantum Register" we obtain in result final "Quantum Register".

If we want to know what is the probability of state of each qubit when measured we just simply calculate magnitude of Complex numbers for each row in final "Quantum Register".

And that's it! Now the Quantum Computer Simulator is ready!

I understand that this post is in some part complicated and doesn't describe all needed details. But this is not my last word in this topic. Check my blog for more posts with "Quantum" label in the future. I will describe there process of building Quantum Computer Simulator more deeply.

You can track my own efforts by visiting my GitHub repository (which is at the moment still in early phase).

If you don't afraid of spoilers you can also check how others have done it. The list of Quantum Computer Simulator projects is available on Quantiki site (it is a sort of Quantum Information Science Club).

Have you also had experience with Quantum Computing before?

What did you like in this post?

What details should I expand in the future posts?

Please leave your comments below.

Comments

Popular Posts