Comparing the Qiskit Aer simulator with an IBM quantum computer
In this recipe, we will create a long quantum circuit that swaps a state between two qubits. You will see that the circuit provides perfect results on your local Qiskit Aer simulator but not quite so perfect results on an actual IBM Quantum® machine.
Getting ready
The sample code for this recipe can be found here: https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience/blob/master/Chapter07/ch7_r2_ootb.py.
How to do it...
Here's the code, stored in the ch7_r2_ootb.py
file:
- As always, start by importing the required classes and methods and load your account:
# Import Qiskit from qiskit import QuantumCircuit from qiskit import Aer, IBMQ, execute # Import visualization tools from qiskit.tools.visualization import plot_histogram from qiskit.tools.monitor import job_monitor # Load account if not IBMQ.active_account(): IBMQ...