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

Add DAGCircuit method to replace block of nodes with another set of nodes #9863

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ewinston
Copy link
Contributor

Summary

When optimizing circuits one often knows a transformation of a subcircuit into a more desirable form. If the initial subcircuit is listed as a set of nodes of a DAGCircuit this can be replaced by another set of nodes.

Details and comments

This works by using DAGCirucit.replace_block_with_op and then DAGCircuit.substitute_node_with_dag to apply the transformation.

@ewinston ewinston requested a review from a team as a code owner March 28, 2023 15:52
@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

@mtreinish
Copy link
Member

mtreinish commented Mar 28, 2023

I did push up a PR to rustworkx to add a native method for doing this based on our earlier discussion: Qiskit/rustworkx#823 when that is merged and in a rustworkx release we can update the internals of this DAGCircuit method to use it.

@ewinston
Copy link
Contributor Author

Thanks @mtreinish! I didn't see that. I can update the PR after it merges.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4545100440

  • 25 of 26 (96.15%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 85.358%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/dagcircuit/dagcircuit.py 25 26 96.15%
Totals Coverage Status
Change from base Build 4544978078: -0.02%
Covered Lines: 67133
Relevant Lines: 78649

💛 - Coveralls

@mtreinish mtreinish added Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants