I want to simulate an arbitrary isolated quantum circuit acting on $n$ qubits (i.e. a pure state of $n$ qubits).

As I know RAM is the bottleneck for quantum simulators, you can consider a "normal" computer to have between $4$ and $8$ Gio of RAM, all the other components are considered sufficiently powerful to not be the bottleneck.

With this definition of a "normal" computer,

What is the maximum value of $n$ (the number of qubits) for which an arbitrary quantum circuit is simulable in a reasonable time ($<1\text{h}$) with a normal computer and freely accessible simulators?

  • 2
    $\begingroup$ You also need to specify how long you're willing to wait, since there are simulation strategies that use very little space but way more time. $\endgroup$ – Craig Gidney Jul 24 '18 at 14:55
  • $\begingroup$ Presumably you're talking about pure states? $\endgroup$ – DaftWullie Jul 24 '18 at 15:26
  • 1
    $\begingroup$ I edited the question, I talk about pure states. $\endgroup$ – Nelimee Jul 24 '18 at 15:45
  • $\begingroup$ All other components are sufficiently powerful, yet you limit time? This does not make sense. $\endgroup$ – Norbert Schuch Jul 24 '18 at 21:08
  • 1
    $\begingroup$ “Arbitrary quantum circuits” are arbitrarily long and so no simulator (or real quantum computer) can complete them within an hour, no matter the number of qubits. $\endgroup$ – DaftWullie Jul 26 '18 at 20:35

This answer doesn't directly answer the question (I have little experience of real simulators with practical overheads etc.), but here's a theoretical upper bound.

Let's assume that you need to store the whole state vector of $k$ qubits in memory. There are $2^n$ elements that are complex numbers. A complex number requires 2 real numbers, and a real number occupies 24 bytes in python. Let's say we want to cram this into $4\times 10^9$ bytes of RAM (probably leaving a few over for your operating system etc.) Hence, $$ 48\times 2^n\leq 4\times 10^9 $$ Rearrange for $n$ and you have $n\leq26$ qubits.

Note that applying gates in a quantum circuit is relatively inexpensive memory-wise. See the "Efficiency Improvements" section in this answer. From that strategy, one should be able to estimate the time it takes to apply a single one- or two-qubit gate to an $n$-qubit system, and hence how many gates you might expect to fit within some times limit (an hour is very modest, but would certainly serve for illustrative purposes).

  • $\begingroup$ I'd say that's a fairly accurate estimate: All the memory you need is basically the one used to store the state. $\endgroup$ – Norbert Schuch Jul 24 '18 at 21:10
  • $\begingroup$ Where do those 24 bytes come from, given that a usual double has 64 bits? $\endgroup$ – Norbert Schuch Aug 15 '18 at 22:24
  • $\begingroup$ @NorbertSchuch I Have no idea! $\endgroup$ – DaftWullie Aug 16 '18 at 5:29
  • $\begingroup$ Could it be that it's just not true? $\endgroup$ – Norbert Schuch Aug 17 '18 at 23:58
  • $\begingroup$ @NorbertSchuch it does seem to be what is consistently claimed online for recent versions of python. There’s nothing wrong with it using 3 times as much memory as you might hope. It’s not like it’s as weird as 24 bits would be. $\endgroup$ – DaftWullie Aug 18 '18 at 5:12

Along with depending on time constraints, as Craig mentioned, you also need to specify how accurate/what gates you want the simulation to have. CHP (CNOT, Phase, Hadamard) simulations can do incredibly large circuits with large numbers of qubits incredible quickly, however they only allow a certain restricted gate set, so some gates, such as T gates, must be approximated.

Other simulations exist (such as quantumsim and others) which store full density matrices, and as a result are much more significantly limited in the number of qubits they work with seeing as they must store a $2^n \times 2^n$ matrix.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.