Looking at quantum circuit simulators
This one is a bit technical. If you’re feeling rusty on your QC fundamentals, don’t read it. Save it. Bookmark this article for later when you’ve brushed up. You’ll be glad you did, especially if you want to understand QCS.
What are they, and why do they exist?
This one is a bit technical. If you’re feeling rusty on your QC fundamentals, don’t read it. Save it. Bookmark this article for later when you’ve brushed up. You’ll be glad you did, especially if you want to understand QCS.
Compare a light bulb to a candle. The former isn’t a more powerful candle; it’s a completely different technology.
Now, comparing your computer to a quantum computer is a leap from fire to fluorescence. So let me tell you a not-so-secret secret. Your fire can simulate fluorescence. I’ll explain.
So what is it?
A quantum circuit simulator (QCS) allows quantum circuits, which use quantum algorithms, to be simulated within your conventional computer. The key word is simulate. On a surface level, the circuit will output the same results but if you peek inside, the inner workings operate on a completely different basis.
Okay, then how does it actually work?
Our computer will have to find some way to simulate quantum mechanical properties classically. The theory of quantum computation gives us a framework to express these computations in a mathematical form. And what is described mathematically can be algorithmized and hence simulated.
For example, let’s say we have a quantum algorithm where certain quantum gates are applied to our quantum states. We need to simulate these quantum gates and qubits. Mathematically, our qubits (pure quantum states) can be represented as a normalized vector (of length 1) in a complex Hilbert space.
The action of the quantum gate would then be expressed as a matrix multiplication of the unitary matrix representing the quantum gate and the said state vector (refer to chapter 6 if interested in simulation techniques). From here, the quantum computations have been reduced to matrix multiplication, and thus is straightforward to implement in your classical framework of choice.
For the inquisitive
- Entangled states are simulated as non-separable multi-qubit states.
- Measurements are simulated by generating random outcomes based on the probability distribution which results from the amplitudes of the state vector.
Then what’s the point of quantum computers?
At the heart of the matter, none of these simulations harness the powers of quantum physics. They’re not actually quantum. So the size of the classically simulated problem grows exponentially with each qubit.
One qubit has two dimensions, two qubits have four, three qubits have eight, you get the pattern. If n is the number of qubits then the number of parameters into a classical simulation is (2^n), an exponential time complexity.
So if we’re trying to simulate 32 qubits, then we need a complex vector with 2³² dimensions. If each entry of the vector is a complex number, with the real and imaginary parts each being expressed in 16 bits, we’re already looking at a memory requirement of
2³² * 2 * 16bits = 17.2 GB
The full-state simulation limit as of today is 48 qubits, past that we lack the physical amount of memory. To put that into context, a meaningful quantum computer requires at least 100 qubits. Thus, we would require true quantum computers.
So… what’s the point of these simulators then?
Simulators are great for a number of reasons:
- Rapid prototyping of small quantum circuits — useful to sanity-check before running on quantum hardware.
- Test circuits with no noise and arbitrary connectivity — nit pick your algorithm by manipulating the ideal quantum state.
- Control the level of noise and uncertainty — maybe you want to simulate a circuit under a noise model, you get to control the strength and type of noise whose effects you want to study
You have access to real quantum computers through the cloud, this was pioneered by IBM in 2016. Before that, engineers relied on QCS to test their design before setting out to build actual quantum hardware.
Here’s the bottom line
I certainly had many questions when I heard that quantum computers can be simulated on our conventional computers. It seemed backwards, like if fire could simulate a light bulb. I felt like it undermined the whole notion of “quantum computers are radically different”.
The truth is, they’re different on a fundamental level, but we can use models like state vectors and matrices to acquaint conventional computers with the idea so that they both arrive at the same conclusion, albeit in two different ways.
If you enjoyed the article or learned something new, you can connect with me on LinkedIn, or see what I’m up to on my monthly newsletter.