Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different pauli_error result from previous releases for two-qubit gate. #1415

Closed
JamesB-1qbit opened this issue Dec 23, 2021 · 1 comment · Fixed by #1420
Closed

Different pauli_error result from previous releases for two-qubit gate. #1415

JamesB-1qbit opened this issue Dec 23, 2021 · 1 comment · Fixed by #1420
Assignees
Labels
bug Something isn't working

Comments

@JamesB-1qbit
Copy link

Informations

  • Qiskit Aer version: 0.10.1
  • Python version: 3.9.9
  • Operating system: MacOS

What is the current behavior?

The tensor of two pauli_error gates after a two qubit gate is different from previous versions. Applying the gate

import qiskit.providers.aer.noise as noise
error_1 = noise.pauli_error([('X', 1/3), ('Y', 1/3), ('Z', 1/3), ('I', 0)])
error_2 = error_1.tensor(error_1)

to a circuit with only a cx gate. (essentially identity circuit) results in the dictionary

{'00': 557, '01' 467}

Steps to reproduce the problem

from qiskit import QuantumCircuit, execute, Aer
import qiskit.providers.aer.noise as noise
error_1 = noise.pauli_error([('X', 1/3), ('Y', 1/3), ('Z', 1/3), ('I', 0)])
err = error_1.tensor(error_1)

noise_model = noise.NoiseModel()
noise_model.add_all_qubit_quantum_error(err, ['cx'])

circ = QuantumCircuit(2, 2)
circ.cx(0, 1)
circ.measure([0, 1], [0, 1])

result = execute(circ, Aer.get_backend('qasm_simulator'), noise_model=noise_model).result()
counts = result.get_counts()
print(counts)

What is the expected behavior?

In previous versions, it results in something close to what I would expect given my understanding of the pauli_error which would be.

counts = {'01': 2 / 9 * shots, '11': 4 / 9 * shots, '10': 2 / 9 * shots, '00': 1 / 9 * shots}

Suggested solutions

Revert to the old behavior or explain in the documentation what a tensored pauli_error is supposed to do in practice.

@JamesB-1qbit JamesB-1qbit added the bug Something isn't working label Dec 23, 2021
@chriseclectic chriseclectic assigned chriseclectic and unassigned itoko Jan 4, 2022
@chriseclectic
Copy link
Member

It looks like a bug in the QuantumError.to_dict method, which is flatting all instructions to qubits [0, ..., n-1]. I will put in a fix for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants