-
Notifications
You must be signed in to change notification settings - Fork 20
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 Incorrect stripping of idle qubits that are not idle in both circuits #372
Labels
Comments
burgholzer
added
bug
Something isn't working
good first issue
Good for newcomers
c++
Anything related to C++ code
labels
Feb 28, 2024
burgholzer
added a commit
that referenced
this issue
May 23, 2024
## Description This PR fixes the issue of incorrectly removing idle qubits that are not idle in both circuits. The following changes have been made: * Previously, idle qubits were removed regardless of their status in both circuits. Now, an idle qubit is removed only if: - it is idle in both circuits - it is idle in one circuit and does not exist in the other circuit * To implement this logic, a dedicated method `stripIdleQubits` has been created in QCEC. This method considers both circuits in conjunction * The `stripIdleQubits` method: - examines each logical qubit in the `initialLayout` of the larger circuit - checks if the corresponding physical qubit is idle - then searches for this logical qubit in the other circuit - if the corresponding physical qubit in the other circuit is also idle, then the logical and corresponding physical qubit are removed from each circuit, respectively, under the following conditions: - neither the logical nor the physical qubit appears in the output permutation (applies to both circuits) - or if the initial and output permutations match for this qubit (applies to both circuits) - if an idle logical qubit is present in one circuit only, it is removed, if neither the logical nor the physical qubit appears in the output permutation, or the initial and output permutations match for this qubit Fixes #372 ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines. --------- Signed-off-by: burgholzer <burgholzer@me.com> Co-authored-by: burgholzer <burgholzer@me.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Environment information
Any OS or Python version. Dates back to the very beginning of QCEC.
Description
If two circuits work on the same number of qubits and one of them has an idle qubit (a qubit that does not have a gate acting on it), the equivalence check might fail because the output permutations of the circuits might not match after the idle qubit in one circuit has been stripped.
This behavior is a result of the fact that the circuits are stripped of idle qubits in isolation, i.e., without considering the other circuit.
mqt-qcec/src/EquivalenceCheckingManager.cpp
Lines 210 to 212 in 5d9cbc1
Expected behavior
An idle qubit should only be removed if it either
This requires a dedicated
stripIdleQubits
method in QCEC that considers both circuits in conjunction.A corresponding implementation can be heavily inspired by the original
mqt-core
implementation.However, I believe that the overall logic could even be improved a little bit given the constrained setting here in QCEC.
How to Reproduce
Thanks @reb-ddm for bringing this up!
The text was updated successfully, but these errors were encountered: