Articles, Blog

Running an experiment in the IBM Quantum Experience

Running an experiment in the IBM Quantum Experience

At IBM we are conducting research to build a universal quantum computer. And to get there we’re putting our quantum computing capabilities on the cloud and making them available to anyone interested in learning or experimenting with quantum information. Now let’s walk through an example of how to use our cloud enabled quantum computing platform to run a simple but fun quantum algorithm called Grover’s search. Now, one of the many advantages a quantum computer has over a classical computer is its efficiency for searching databases. Grover’s Algorithm reflects this capability and provides a quadriatic speed up on an unstructured search problem. Now a good way to appreciate this algorithm is actually consider a simple card game like Four card Monty. We have four standard playing cards, only one of which is a queen. Now when the queen is hidden and the cards all shuffled around it could be any one of four positions. Now on average it would take you two and a quarter tries to find that queen with only a chance of one in four of getting it on the first shot. But with a quantum computer you can run Grover’s algorithm using two of the qubits in our processor to get the right answer on the first and only try. Here’s how we run Grover’s algorithm through our composer tool: on the composer tab we can see what essentially looks like a music staff, with each line representing one of the qubits in our processor, although there are five qubits that we can use we’re going to focus on just two of them for the purpose of this algorithm. I’m going to put in a number of these different gates and construct this entire Grover’s algorithm. So now we’ve got all the case that we need to run Grover’s search algorithm in the composer. Let me describe some of these different parts: the first part over here involves making a super position state of both qubit one and qubit two, using this “H” case or Hadamard gate. The second part is what’s known as the oracle function. This is equivalent to basically hiding the queen and what we’ve selected here is actually a combination of gates that hides the queen in the fourth slot. That’s then followed by this quantum inversion step. Now this is a sequence of gates which we will put in for this algorithm regardless of any of the different slot that we would have chosen to hide the queen. The real power Grover’s algorithm sits right here in this inversion step. It takes the entangled space of the two qubits and turns it into something that we can measure and understand at the end. And that’s done by doing these measurements on both the qubits, right here. We can take this whole algorithm and run it on our actual processor. We also choose to simulate it with this simulate button on an ideal case. But we’d like to see what happens with the real processor. So we hit run and what we’d like to see is this real quantum advantage of running this out of them for finding the queen and what we would like to do is just run it once. So we’re going to select one shot here. We’re going to ask it to run a new execution which sends that code directly to our quantum processor in the lab. After our execution has been run it goes into the queue in our actual processor and we wait for the results to come back and we look for it in my scores tab. Here in my scores we can see all the different algorithms which we ran through the composer tool, and the top-most one here is this Grover’s search algorithm we just ran. And we can see that the results are actually in and so we hit this little bar graph button and find the results. And in this case what we found is, with a single shot of running Grover’s algorithm, we found “one one” corresponding to that fourth slot where we had the queen. With just a single run of Grover’s algorithm, we’re able to find the queen. Where as in the case of classical card playing, would have taken us two and a quarter tries to find it.

Be the First to comment.

Leave a Comment

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