# How is quantum error applied to the qubits?

I am trying to check the way qiskit has the noise implemented. I have read how is this theoretically done using quantum channels (see Nielsen and Chuang chapter 8) and I want to verify if qiskit follows the same procedure. I have started by the bit-flip error using the pauli_error function. Finally it creates a quantum error object which can be added to the NoiseModel object. However when adding this you have to use the add_all_qubit_quantum_error function and I do not really understand how this works. It is supposed to add the quantum error to all qubits when given a set of gates as an argument, as in the following example:

# Example error probabilities
p_reset = 0.03
p_meas = 0.1
p_gate1 = 0.05

# QuantumError objects
error_reset = pauli_error([('X', p_reset), ('I', 1 - p_reset)])
error_meas = pauli_error([('X',p_meas), ('I', 1 - p_meas)])
error_gate1 = pauli_error([('X',p_gate1), ('I', 1 - p_gate1)])
error_gate2 = error_gate1.tensor(error_gate1)

# Add errors to noise model
noise_bit_flip = NoiseModel()

print(noise_bit_flip)


However I do not know when the bit-flit is applied. Is it applied everytime one gate that can be decomposed in any of the ones of the list ["u1", "u2", "u3"]? What I need to know is how often it is applied and with which criterion.

Qiskit simulator behaves like this for your code snippet: whenever it encounters one of u1, u2, or u3 gates (in the compiled circuit), it first applies the gate; then it performs an X gate according to the provided probability (0.05 in our case).

• Thank you so much for your answer! And when you refer to the compiled circuit as we are using the basis gates provided by the standard noise model the gates that I choose for my circuit will be decomposed in terms of the ones of the basis and the noise will be applied to them. Just imagine I place a Hadamard gate, this will be decomposed into basis gates so the noise can be applied. Is it this way? That is what I have been told. – Paula G Jan 26 at 17:06
• Yes, that's right. – Yael Ben-Haim Jan 28 at 6:35