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

Fix bug in tomography conditionals on multiple cregs #967

Merged
merged 5 commits into from
Nov 8, 2022

Conversation

chriseclectic
Copy link
Collaborator

Summary

Fixes #943

Fixes bug in StateTomography and ProcessTomography experiments where if the input circuit contained conditional instructions with multiple classical registers the tomography measurement circuits would contain incorrect conditionals due to a bug in the QuantumCircuit.compose method.

Details and comments

This fixes the issue by creating a tomography template circuit containing the same registers as the input circuit with an additional classical register added for tomography measurements, rather than creating a template with a single flat classical register of the required total number of classical bits.

Updates tomography circuit generation to work around issues in QuantumCircuit.compose for circuits with conditional instructions on multiple registers.
@chriseclectic chriseclectic added backport stable potential The issue or PR might be minimal and/or import enough to backport to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels Nov 7, 2022
Copy link
Contributor

@ihincks ihincks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. Found one tiny copy-paste typo.

test/library/tomography/test_process_tomography.py Outdated Show resolved Hide resolved
@chriseclectic chriseclectic merged commit fa08a9a into qiskit-community:main Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable potential The issue or PR might be minimal and/or import enough to backport to stable Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StateTomography reconstructs wrong density matrix when c_if involved
2 participants