Executing quantum circuits with custom noise models
We'll create our standard circuit out of a Hadamard and CNOT circuit, which, as we know from earlier, will result in equal probabilities of 00 and 11. Let's now run it with our noise model and see what results we get and compare them:
# Create a simple 2 qubit circuit qc_error = QuantumCircuit(2,2) # Place in superposition and entangle qc_error.h(0) qc_error.cx(0,1) # Measure the qubits to the classical bits. qc_error.measure(range(2), range(2))
Now that we have our circuit created, we'll add our custom noise model.
Adding custom noise models to our circuits
We'll begin by obtaining the Qasm simulator, calling the execute method and including the usual arguments, namely, circuit, backend, and the number of shots. We'll also include the noise model information. Similar to how we included a thermal relaxation noise model earlier, we will provide the noise model basis_gates
, and noise_model
. This...