You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: Ubuntu 20.04.3 LTS (Windows Subsystem for Linux 2)
What is the current behavior?
The two 2-qubit errors with the same superoperator affects the same CNOT gate in different ways.
Steps to reproduce the problem
import numpy as np
from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator
import qiskit.providers.aer.noise as noise
from qiskit.providers.aer.noise import QuantumError
from qiskit.providers.aer.noise import thermal_relaxation_error
from qiskit.quantum_info import SuperOp
# Make a circuit
circ = QuantumCircuit(2)
circ.cx(0,1)
circ.save_superop(pershot=False)
# Create a 2-qubit thermal relaxation error
gate_len_1 = 200
gate_len_2 = 200
T1_1 = 100
T1_2 = 100
T2_1 = 100
T2_2 = 100
error_1 = thermal_relaxation_error(T1_1, T2_1, gate_len_1, excited_state_population=0)
error_2 = thermal_relaxation_error(T1_2, T2_2, gate_len_2, excited_state_population=0)
error = error_1.expand(error_2)
# Noise model 1, add error directly
noise_model_1 = noise.NoiseModel()
noise_model_1.add_quantum_error(error, ['cx'], [0,1]) # apply the error to CX(0,1)
# Make a corresponding noisy simulator
simulator_1 = AerSimulator(method='superop', noise_model=noise_model_1)
# Perform a noise simulation, record the super operator of noisy CX gate
result_1 = simulator_1.run(circ.copy()).result()
superop_CX_1= result_1.data()['superop'].data
# Noise model 2, make the same error, but from the superoperator
noise_model_2 = noise.NoiseModel()
error_ver_2 = QuantumError(error.to_quantumchannel())
noise_model_2.add_quantum_error(error_ver_2, ['cx'], [0,1])
# Make a corresponding noisy simulator
simulator_2 = AerSimulator(method='superop', noise_model=noise_model_2)
# Perform a noise simulation, record the super operator of noisy CX gate
result_2 = simulator_2.run(circ.copy()).result()
superop_CX_2= result_2.data()['superop'].data
# To check if both error and error_ver_2 has the same superoperator
print(np.linalg.norm(error.to_quantumchannel().data - error_ver_2.to_quantumchannel().data)) # it prints 1.452288788600663e-15.
# To check if both noise model gives the same noisy CNOT gate
print(np.linalg.norm(superop_CX_1 - superop_CX_2)) # it prints 2.4265909917740323
What is the expected behavior?
I suppose print(np.linalg.norm(superop_CX_1 - superop_CX_2)) gives a very small number (in the scale of 1e-12 to 1e-16). Because both noise models apply the same noise superoperator to the same CNOT gate. In fact, in the noise model 2, if I write error_ver_2 = QuantumError(error), both noisy CNOT gates are exactly the same.
Thanks for your time! If it is just because I did not understand how QuantumError works, then I apologize for the trouble, and please enlighten me.
Muqing
The text was updated successfully, but these errors were encountered:
I think this is a manifestation of the same bug as #1415. Could you try upgrading to Aer 0.10.2 and check whether it works correctly there? (For what it's worth, I get the same results up to 1ULP with Aer 0.10.2+, but can reproduce your error with Aer 0.10.1.)
Thank you. It is indeed the same issue. I have no problem with Aer 0.10.2.
I think this is a manifestation of the same bug as #1415. Could you try upgrading to Aer 0.10.2 and check whether it works correctly there? (For what it's worth, I get the same results up to 1ULP with Aer 0.10.2+, but can reproduce your error with Aer 0.10.1.)
Informations
What is the current behavior?
The two 2-qubit errors with the same superoperator affects the same CNOT gate in different ways.
Steps to reproduce the problem
What is the expected behavior?
I suppose
print(np.linalg.norm(superop_CX_1 - superop_CX_2))
gives a very small number (in the scale of 1e-12 to 1e-16). Because both noise models apply the same noise superoperator to the same CNOT gate. In fact, in the noise model 2, if I writeerror_ver_2 = QuantumError(error)
, both noisy CNOT gates are exactly the same.Thanks for your time! If it is just because I did not understand how
QuantumError
works, then I apologize for the trouble, and please enlighten me.Muqing
The text was updated successfully, but these errors were encountered: