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

Swap removal fix #38

Merged
merged 10 commits into from
Oct 25, 2024
Merged

Swap removal fix #38

merged 10 commits into from
Oct 25, 2024

Conversation

eggerdj
Copy link
Collaborator

@eggerdj eggerdj commented Oct 18, 2024

Summary

This PR fixes #37

Details and comments

The way the layout is permuted in the SWAP cancellation pass is modified.
This PR adds a test to catch this issue.

@eggerdj eggerdj requested a review from ElePT as a code owner October 18, 2024 15:47
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -34,8 +32,7 @@ def run(self, dag: DAGCircuit):
successors = list(dag.successors(node))
if len(successors) == 2:
if all(isinstance(successors[idx], DAGOutNode) for idx in [0, 1]):
bits = [qreg.index(qubit) for qubit in node.qargs]
qmap[bits[0]], qmap[bits[1]] = qmap[bits[1]], qmap[bits[0]]
qmap.swap(node.qargs[0], node.qargs[1])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Much cleaner :)

@ElePT ElePT merged commit d2257c0 into qiskit-community:main Oct 25, 2024
8 checks passed
@eggerdj eggerdj deleted the swap_removal_fix branch October 29, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SwapToFinalMapping bug
2 participants