I'm reading the chapter Introduction to Quantum Error Correction using Repetition Codes and a code example demonstrates how to add depolarizing and pauli error. I have several questions.
Is it not necessary to have an error_gate for the Pauli-I operator as defined in pauli_error
?
Does using .tensor
on error_gate1
to create error_gate2
replicate the error_gate1
line for error_gate2
? Why can't you simply use error_gate1
instead of a creating a second equivalent error_gate2
?
Is it necessary to have an error_gate
for cx, or is that an arbitrary choice for this particular example? Code-wise, is it acceptable to have a noise_model with just an error_gate1
applied to the x_gate
, or is there something impractical about that?
def get_noise(p_meas,p_gate):
error_meas = pauli_error([('X',p_meas), ('I', 1 - p_meas)])
error_gate1 = depolarizing_error(p_gate, 1)
error_gate2 = error_gate1.tensor(error_gate1)
noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(error_meas, "measure") # measurement error is applied to measurements
noise_model.add_all_qubit_quantum_error(error_gate1, ["x"]) # single qubit gate error is applied to x gates
noise_model.add_all_qubit_quantum_error(error_gate2, ["cx"]) # two qubit gate error is applied to cx gates
return noise_model