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 flipping of gate direction in transpiler for CZ gate #8625

Merged
merged 9 commits into from
Sep 22, 2022

Conversation

peendebak
Copy link
Contributor

@peendebak peendebak commented Aug 26, 2022

Summary

Fixes #8387.

Details and comments

The CZ gate is symmetric, so should not fail in a pass that flips gates to match the coupling map.

Implementation based on code by @JMuff22

@peendebak peendebak requested a review from a team as a code owner August 26, 2022 19:21
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Aug 26, 2022
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Aug 26, 2022

Pull Request Test Coverage Report for Build 3104955084

  • 8 of 13 (61.54%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.004%) to 84.403%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/utils/gate_direction.py 8 13 61.54%
Totals Coverage Status
Change from base Build 3102513100: -0.004%
Covered Lines: 59270
Relevant Lines: 70223

💛 - Coveralls

@mtreinish mtreinish added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Sep 15, 2022
@mtreinish mtreinish added this to the 0.22 milestone Sep 15, 2022
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Overall the code LGTM, but before we merge do you mind adding a fixes relaese note to document the the bugfix. The process for doing that is documented here: https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#release-notes

@peendebak
Copy link
Contributor Author

Overall the code LGTM, but before we merge do you mind adding a fixes relaese note to document the the bugfix. The process for doing that is documented here: https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#release-notes

@mtreinish Release notes have been added.

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding the release note

---
fixes:
- |
Fix a problem in the `GateDirection` transpiler pass for the CZ gate. The CZ is symmetric, so flipping the qubit arguments is allowed to match the directed coupling map.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Fix a problem in the `GateDirection` transpiler pass for the CZ gate. The CZ is symmetric, so flipping the qubit arguments is allowed to match the directed coupling map.
Fixed an issue in the :class:`~.GateDirection` transpiler pass for circuits with :class:`~.CZGate. The CZ gate is symmetric, so flipping the qubit arguments is allowed to match the directed coupling map.

@mergify mergify bot merged commit 0f688eb into Qiskit:main Sep 22, 2022
@peendebak peendebak deleted the cz_flipping branch September 26, 2022 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: transpiler Issues and PRs related to Transpiler
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Flipping of gate direction in Transpiler for CZ gate
5 participants