Working with the IBM Q

Did you know that you have access to a bleeding-edge quantum computer? Bet you didn’t! The IBM Q is a community access quantum computer. Which is one way of saying IBM is letting you program one of their quantum computers in exchange for all the rights of the programs you come up with. Yeah, I read the privacy policy.

All jadedness aside, I decided to give it a try. I will not have access to one of these for a while, so I will roll with the flow a little bit.

Quantum computing has been around sometime. It is a strange, foreign land compared to traditional computing. Instead of bits and bytes it uses qubits. A qubit can be a one and/or zero. It can be a one and a zero at the same time.

Because of the data structure inherent to quantum computing, quantum computing has great potential for database storage and access. In my trial with the IBM Q, I used a known algorithm called the Grover algorithm. This algorithm is a simple data retrieval “magic trick” so to speak.

This algorithm is supposedly able to win the “four card Monty” on the first try. I.e. there are four unknown cards flipped over on a table, one is the Queen (desired card). The person playing tries to guess the Queen card. This program simulates the four card Monty, and the IBM Q is supposed to be able to guess the Queen on the first try. The composition looks like this (a composition is just what they call a program).

The IBM Q Experience page allows users to both run compositions in the actual Quantum computer and as a simulation. This is because as a new user you only get limited access to the computer. You get a few tokens and each real quantum computing run charges you a tokens. So it is best to do a few free simulations before doing an actual run.

The composition above describes a Queen burried in position four. The way we count in the results is 00000=1, 00010=2, 00100=3, and 00110=4.

So I put the card in position 4. The computer is set to only do one trial (called a “shot”) of the program. I.E. it accesses only one card. Let’s see what we get.

Here are the results:

The simulator worked! It guessed that the Queen was buried in the fourth position! Why is this cool? Well, this means that the quantum computer could accurately guess where the card is with just one trial. I.E. it could win four card Monty on the first try every time. How? I am not exactly sure. I read the manual describing this program and here is what I think is happening.

From what I read in the manual, it guesses one data point (one card). Based on the result of this card, it can calculate which card is the most likely to be the Queen. It can do this because of quantum phenomena. Because of entanglement with the other data points, the Q can “sense” where in the database the queen most likely is. It then returns the most likely card then. Additionally, classical computers would take N/2 guesses to find the correct card. Quantum computers can access information in as little as sqrt(N) tries.

So the simulator worked. Let’s see what happens when I ran the actual trial in the IBM Q.

An echoing “wtf” rings in my head. The actual computer got it wrong! It says the Queen is in the third position. Odd!

I tried the simulation again. This time I edited the program to put the card in the first position like this:

The result? It worked!

The result is 00000, or the first position as I mentioned earlier. Cool!

It is worth mentioning that the first real trial (run) took almost a day, and the second real trial took less than one minute. I’ve also looked at cached results of similar experiments. Other’s have gotten a few missed results as well. The error may be because of a few reasons. The Q needs to be calibrated periodically. Maybe the Q did not drink it’s coffee that day. Or, the amplitude amplification step (see the manual) simply failed to retrieve the best result. Here I thought it was perfect! Oh well, it is still cool to see the correct guess a couple of times.

Using the IBM Q is a free way to break into the world of quantum computing. I think that this technology may be a breakthrough in database search speed. Overall, was it worth giving IBM my email address? Yeah I suppose. Should have used a spammier email account though so I don’t get a newsletter. It is an interesting learning tool, that’s for sure.

To access the Q go to:

https://quantumexperience.ng.bluemix.net/qx/community

To access information about Grover’s Algorithm (used in this simulation and run), go to

https://quantumexperience.ng.bluemix.net/qx/tutorial?sectionId=8443c4f713521c10b1a56a533958286b&pageIndex=2

Hint: if you read the manual you get increased access.

Leave a Reply

Your email address will not be published. Required fields are marked *