Do you think you need to know quantum physics to understand how a quantum computer works? Nope, no worries there. You don't need a deep dive into physics or mathematics, just a bit of familiarity with vectors and matrix multiplication. That's really it. A good handle on Python programming and a few numpy functions will do the trick, specifically: reshape
, kron
, matmul
, swapaxes
, linalg.norm
, and random.choice
.
In fact, twelve lines of Python code suffice to define a complete simulator.
The whole point of this project is to give you an informal, brief, hopefully digestible and educational description of how you can easily implement your own quantum computer simulator. It's not about 'Yet Another Quantum Computer Simulator', which are a dime a dozen, but about how to build your own. And, honestly, there's probably no better way to learn how a quantum computer works!
The project contains annotated Python for the report How to program your own quantum computer simulator or QUBE: QUantum computing for BEginners available on arXiv with URI DOI:10.48550/arXiv.2312.06624 or short URI DOI:10/k8hd.
The code was developed by Martin Nilsson at RISE Research Institutes of Sweden, Computer Systems Unit. It comes in the form of a Jupyter Notebook, originally using Python version 3.11.5 and PyTorch version 2.1.1.