Noise-Free Simulation Limits
A full state-vector simulator stores one amplitude for each of the 2^n possible readouts. In QPU137 each amplitude takes 16 bytes. So memory doubles with every qubit you add. 20 qubits need 16 MiB, and 30 need 16 GiB. 45 qubits needed about half a petabyte on a supercomputer. That doubling curve, not a lack of effort, is why browser simulation stops in the mid-twenties.
What does a perfect simulator actually store?
Why care? Knowing this tells you which circuits you can test on a laptop, and why no laptop will ever simulate a big quantum chip.
The QPU137 simulator is a state-vector simulator. It keeps the whole quantum state as one long list called the state vector. The list holds one amplitude for every possible basis state. A basis state is one way to set every qubit to 0 or 1. An amplitude is a complex number, a number with two parts. Square its size and you get the chance of that readout.
Let's count the basis states:
- 1 qubit has 2: |0⟩ and |1⟩.
- 2 qubits have 4.
- 3 qubits have 8.
- 5 qubits have 32.
Each new qubit doubles the count. So n qubits need 2^n amplitudes.
Each amplitude is stored as two 64-bit decimal numbers, a real part and an imaginary part. That is 8 + 8 = 16 bytes per amplitude, before any extra working space. Multiply the two numbers together, and you have the whole memory story of perfect simulation.
It is like the old story of rice on a chessboard. One grain on the first square, two on the next, then four, then eight. It starts tiny and ends bigger than any barn. Unlike the rice, we can stop at any square, but every square past the mid-twenties no longer fits in a browser.
- Worked example: how fast does memory grow?
- Run it: 32 amplitudes, two of them busyINTERACTIVE
- Why does each gate get slower too?
- Can't we skip the state and just sample?
- Try this: can I reason from the state, not the histogram?INTERACTIVE
- What changes on real hardware?
- What should a developer remember?
You’ve read the opening of chapter 12. Pro unlocks the other 7 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.