I want to compare the fidelity of a circuit implemented on IBMQ Santiago with the ideal circuit simulated using the statevector backend. Is there a way to do this? So far I have only seen examples where both circuits involve the statevector backend.
1 Answers
It is not possible to compare the statevector of a circuit run on the statevector_simulator and on a real device, like IBMQ Santiago, because the result of a job run on hardware is in the form of counts. You can see this by running the following command in qiskit:
job.result().data(circuit)
for a specific circuit and job run on a real IBMQ device. The output you will get will be in the form of
{'counts': {...}}
where {...} is a dictionary mapping states to counts for those states.
If you run the same command on a job run on the statevector simulator, you will get
{'counts':{...}, 'statevector': array([...])}
where array([...]) is an array form of the resulting statevector, and the dictionary for counts maps that same statevector to a count of 1.
However, you can compute the hellinger fidelity, which compares counts instead of state vectors. You can read more about it here: https://qiskit.org/documentation/stubs/qiskit.quantum_info.hellinger_fidelity.html

- 479
- 3
- 5
-
Perfect, this is exactly what I was looking for! Thank you so much! – sycramore Sep 09 '20 at 21:17
-
No problem, glad to be of help :) – Winona Sep 10 '20 at 18:12