In Qiskit we can't use noise models in the 'state vector_simulator' or the 'unitary simulator', hence making it impossible to compute fidelity of the output of the noisy circuit and the noiseless circuit. We can, of course, do a noisy simulation using the qasm simulator but it gives us the probability distribution instead of a state vector/density matrix. How do we compare the fidelity in this case? Or is there any other way to do it?


I think you can use noise in the statevector simulator. If nevertheless you want to use the qasm simulator, you can use snapshots: https://qiskit.org/documentation/apidoc/aer_extensions.html. Although in the lack of notebooks it's a little tricky to understand how to use. You can see examples here for how to insert a snapshot in a circuit: https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/reference/ref_snapshot_state.py. Then another example here for how to read the snapshot result: https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/backends/qasm_simulator/qasm_snapshot.py If you apply the snapshot on a subset of the qubits, be aware that the qubit ordering may be confusing.

| improve this answer | |
  • $\begingroup$ Hey, Yael thanks. I have tried using snapshots in the qasm simulator, but it fails while I include the noise model like without the noise model it shows proper results(gives a proper state vector) but when I try to include any noise it gives the state vector with all zeros. And I think we cannot use noise models in SV sim because of its just one shot simulation, unlike the qasm simulator which in which we can do enough shots to implement the probability of the errors in the noise model. $\endgroup$ – Pingal Pratyush Nath Aug 27 at 10:24
  • $\begingroup$ Discussion has moved to github.com/Qiskit/qiskit-aer/issues/908 $\endgroup$ – Yael Ben-Haim Aug 30 at 16:18

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.