Recently I focused on how to simulate in classical computer, and I found Qiskit offers qasmsimulator and statevector simulator. And others such as project Q also can simulate on classical computer. So is there a general way to simulate on classical computer? And what are differences among simulators? I mean actually it seems like we just need to multiply gate operation as matrixes.


1 Answer 1


There are three major levels of simulation difficulty (broadly, there are a bunch of others, but these are the main levels.)

Clifford simulators can simulate circuits composed of only Clifford elements on stabilizer states. This is classically efficient, since it is classically efficient to calculate the propagation of a Pauli operator through a Clifford gate. As a result, the simulator takes the stabilizers of the input state, propagates them through the circuit, and the resulting stabilizer group represents the final state. The idea that a quantum algorithm needs non-Clifford gates to be better than a classical one comes from the fact that a fully Clifford quantum algorithm could be simulated classically in polynomial time.

The second level of simulation is State Vector simulation. In this case, we are basically doing what you mentioned in your question. We take an input state (of size $2^n$, where n is the number of qubits) and then apply gates to it through matrix multiplication. Due to the exponential size of the state, this requires resources exponential in the system size to be simulated, and as a result is not considered classically efficient. The only restriction on these simulations is that the gates must all be unitary and all states must be pure.

The last level is Density Matrix simulation. Here, we store the full $2^n \times 2^n$ density matrix of the state. As a result we can simulate any quantum channel, and mixed states are permissible. However we now have an even bigger object to work with. These simulations are often necessary for doing work on simulating physical noise or other non-unitary processes, but are extremely limited in size due to their exponential resource requirements.

  • $\begingroup$ What about qasm sampling? $\endgroup$
    – mavzolej
    Commented Jul 10, 2020 at 2:52
  • $\begingroup$ Sorry, I still dont get the difference between second and last. I mean, it seems both are matrix simulation approaches just one uses state vector and the other use density matirx. only difference between the representation ways? and the simulation approaches i see in paper are more likely the second one, for example, arxiv.org/pdf/1805.01450.pdf $\endgroup$ Commented Jul 10, 2020 at 3:31
  • $\begingroup$ State vectors can only represent pure states, while density matrices can also represent mixed states. Maybe reading en.wikipedia.org/wiki/Density_matrix would be helpful for understanding the difference. Essentially a density matrix approach could simulate something like a depolarizing noise model without the need for monte carlo. The paper you linked is actually a bit more unique. They have a simulation which can identify a single amplitude of a SV, as opposed to the entire vector, and follows different rules/structure. $\endgroup$ Commented Jul 10, 2020 at 5:52

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.