• Members 19 posts
    Sept. 5, 2021, 7:42 a.m.

    In the tutorial of VQE in qiskit, the backend is chosen to be sometimes statevector_simulator, and other times qasm_simulator. Can anyone explain the major difference between the two?

  • Members 11 posts
    Oct. 14, 2021, 10:07 p.m.

    statevector_simulator keeps track of the state vector itself. When asking about the measurement probability, it would corresponds to the abs square of the amplitudes.
    qasm_simulator is similar to how things work on a hardware. You do not have access to the state vector, and you have to specify the number of shots. Each shot represent a sample in the measurement space. So the measurement probability would be the distribution of the samples.
    For example, if your state is $|\psi\rangle =\sqrt{0.1}|0\rangle+\sqrt{0.9}|1\rangle$,
    using statevector_simulator, your measurement probability would be (0.1,0.9), which is the perfect simulation.
    using qasm_simulator, your measurement probability would depend on the number of shots. For example, if your shot is 100, you won't necessarily get (0.1,0.9), you may get (0.09,0.91) or (0.11,0.89), or some other distributions close to the original, since this is the result of sampling!