5-qubit quantum computing simulator

Since IBM released access to its 5-qubit quantum computer, with accompanying tutorial and ability to simulate and program it easily (via a graphical language that spits out a simple code for archival along with results), I’ve been kind of obsessed.

As I worked my way through the tutorials in IBM’s simulator, for my own benefit I went through them on pen and paper as well for as long as possible along side to make sure I followed the math.  As the calculations got more and more complicated I started to check my work in python numerically, and towards the very end moved to python entirely. At first I used numpy and basic matrix math, but as examples got more complicated (entanglement) I started building in more and more abstraction.

Eventually I ended up with an entire working reimplementation, to the example, of their ideal 5-qubit quantum computer simulator. You can check it out on my github. There you will also find more complete details of usage which extends beyond IBM’s tutorial code. In the general case, the complexity of quantum mechanics is not possible to simulate efficiently. But for 5 qubits it’s not too bad in the end. The majority of the execution time of my test code is taken when I simulate thousands of runs in a row to check my probabilistic measurement code. As a bonus, my code should be fairly easy to extend to even more qubits; the major algorithms are independent of it.

For other quantum computing resources, I recommend John Preskill’s notes on quantum computation, Quantum Computing and Quantum Information by Michael Nielsen and Isaac Chuang, Berkeley’s Quantum Mechanics and Quantum Computing Lectures and Quantum Computing Since Democritus by Scott Aaronson. The former two are on the steeper end of the learning curve and I’m still working through them. The latter two are suitable for an interested layperson, as is of course IBM’s excellent tutorial itself.

It still amazes me that I can run on an actual honest-to-goodness 5-qubit quantum computer, remotely from Antarctica no less (thanks IBM Research). I’m excited that going through and improving my ability to iterate on algorithm design by implementing my own simulator has given me a greater understanding of how best I might utilize the power of the real thing in the future. I also hope that the code I developed is useful on your journey to understand quantum computation just a little better.

 

Leave a Reply

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