-
Notifications
You must be signed in to change notification settings - Fork 29
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 idle qubit detection to ignore barriers #639
base: main
Are you sure you want to change the base?
Fix idle qubit detection to ignore barriers #639
Conversation
|
Added if instruction.operation.name == 'barrier': continue to skip over barrier operations during the idle wire detection process. |
Pull Request Test Coverage Report for Build 10002802415Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
It'd be nice to have an explicit test for this behavior, too. |
The lint failure can be fixed by merging |
@raunakkumarsingh, thank you for this contribution. Do you plan to add a test and merge |
198e8fc
to
6613701
Compare
I have added tests for the barrier Ignore and rebased my branch. |
Thank you. Please run |
corrected lint |
circuit.y(2) | ||
circuit.h(2) | ||
|
||
separated_circuits = separate_circuit(circuit, partition_labels="ABC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I believe this test does not actually check that the relevant bug is fixed.
The idle wire detection code only runs when partition_labels
is not provided (or is None
). In this case, the partition labels are determined automatically from the connectivity of the circuit. #594 improved on this code so that idle wires are removed from the circuit during separation, but the problem is that any qubit with a barrier (e.g., if a barrier is placed over all qubits, even the idle ones) will be falsely detected as an active qubit. Your change should indeed fix #621 but the test does not ensure that it is fixed. The test is actually almost testing the check desired in #626, but not quite.
Fixes #621
Check for Barriers:
Added if instruction.operation.name == 'barrier': continue to skip over barrier operations during the idle wire detection process.
Iterate Through Instructions:
For each instruction, if it is not a barrier, it iterates through the qubits involved in the instruction and removes those qubit indices from the idle_wires set.
Filter Qubit Subsets:
The qubit_subsets list is filtered to remove any subsets that consist of only one qubit, and that qubit is in the idle_wires set.