2
$\begingroup$

The full density matrix of 30 qubits contain $2^{30}$ states. How does qiskit/qasm implement this without storing and computing the full $2^{30}$ density matrix of possible state coefficients?

$\endgroup$
2
  • 1
    $\begingroup$ 30 qubits means 2^59 coefficients in the density matrix. I'm not aware that Qiskit supports anything close to it. $\endgroup$ Jun 5, 2023 at 6:43
  • $\begingroup$ @YaelBen-Haim thank you. i got the number 30 by googling into other answers on this site like quantumcomputing.stackexchange.com/questions/14927/… ? How many qubits can Qiskit realistically work with? $\endgroup$
    – James
    Jun 5, 2023 at 6:57

1 Answer 1

1
$\begingroup$

From the IBMQ/Qiskit platform you can see the available simulators with their basic features.

enter image description here

Both simulator_statevector and ibmq_qasm_simulator are able to perform a full statevector or density matrix simulation and they scale up to 32 qubits. However, this is just the maximum nominal value; in practice, the size of the quantum system you can fully simulate really depends on the memory and the computing power you have at your disposal.

$\endgroup$
6
  • $\begingroup$ thank you. I suspect the right implementation should be something sparse like $\Psi = [["110011", 0.3], ["001101", 0.5], ["111000", 0.2]]$ instead of traditional full matrices with mostly 0 entries? $\endgroup$
    – James
    Jun 5, 2023 at 10:16
  • 2
    $\begingroup$ It's not sparse. It allows you to try to simulate up to 32 qubits, but it doesn't guarantee that you'll have enough time and memory for it. Have to distinguish between statevector simulation and density-matrix simulation. The former can handle twice the number of qubits. $\endgroup$ Jun 5, 2023 at 11:03
  • $\begingroup$ @YaelBen-Haim i wonder how much we can assume about sparcity of the density matrix... in quite a few applications with as many as 2^!0=1024 states, only 16 or so states ever have no-zero values... The gates we use like X, Z, double H-H seem all very controlled in that they won't suddenly jumble the numbers into more than 1 dozen active states or so? $\endgroup$
    – James
    Jun 5, 2023 at 13:54
  • $\begingroup$ Maybe I'm missing something but a 32 qubit state vector simulation would require sizeof(float) * 2^32 = 8GB of memory to hold the state vector (with floats). A gate can be applied in linear time, powering through those 8GB for each gate. Depending on the algorithm, a sparse representation as introduced by libquantum can make things dramatically smaller / faster. $\endgroup$
    – rhundt
    Jun 6, 2023 at 16:18
  • $\begingroup$ @rhundt I think you're missing a few factors of two. Float is 4bytes and you need two for a complex number. So closer to 32GB. Still doable though, so long as your unitary is not complicated $\endgroup$ Jul 4, 2023 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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