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 creation of registers in synthesis methods (backport #13086) #13123

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 10, 2024

Summary

Fixes #13041 (and the same problem in other places, but no one complained yet 🙂).

Details and comments

With the moving the circuit creation to Rust-space, we created circuits that did not have any quantum (or classical) registers, which led to issues as #13041. This PR adds an argument add_regs to QuantumCircuit._from_circuit_data (default False) which allows to add these registers and create backward-compatible circuits. In places where the final circuit was created from circuit data, this argument is set to True.


This is an automatic backport of pull request #13086 done by [Mergify](https://mergify.com).

* add qregs to output circuits

* never develop while not on up-to-date main

* one shan't commit faster than ones IDE can run black

* avoid compose

(cherry picked from commit 1962704)

# Conflicts:
#	qiskit/synthesis/linear_phase/cz_depth_lnn.py
#	qiskit/synthesis/permutation/permutation_reverse_lnn.py
@mergify mergify bot added the conflicts used by mergify when there are conflicts in a port label Sep 10, 2024
@mergify mergify bot requested a review from a team as a code owner September 10, 2024 15:21
Copy link
Contributor Author

mergify bot commented Sep 10, 2024

Cherry-pick of 1962704 has failed:

On branch mergify/bp/stable/1.2/pr-13086
Your branch is up to date with 'origin/stable/1.2'.

You are currently cherry-picking commit 1962704cf.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   qiskit/circuit/quantumcircuit.py
	modified:   qiskit/synthesis/clifford/clifford_decompose_bm.py
	modified:   qiskit/synthesis/clifford/clifford_decompose_greedy.py
	modified:   qiskit/synthesis/linear/cnot_synth.py
	modified:   qiskit/synthesis/one_qubit/one_qubit_decompose.py
	modified:   qiskit/synthesis/permutation/permutation_full.py
	modified:   qiskit/synthesis/permutation/permutation_lnn.py
	modified:   qiskit/synthesis/two_qubit/two_qubit_decompose.py
	new file:   releasenotes/notes/fix-synth-qregs-7662681c0ff02511.yaml
	modified:   test/python/quantum_info/operators/symplectic/test_clifford.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   qiskit/synthesis/linear_phase/cz_depth_lnn.py
	both modified:   qiskit/synthesis/permutation/permutation_reverse_lnn.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@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 following people are relevant to this code:

  • @Qiskit/terra-core
  • @levbishop

@github-actions github-actions bot added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Sep 10, 2024
@github-actions github-actions bot added this to the 1.2.1 milestone Sep 10, 2024
some methods are not available in Rust on 1.2, so there's no add_regs flag to add
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10807347177

Details

  • 22 of 27 (81.48%) changed or added relevant lines in 5 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 89.795%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/quantumcircuit.py 16 21 76.19%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 93.73%
Totals Coverage Status
Change from base Build 10735835379: 0.02%
Covered Lines: 66884
Relevant Lines: 74485

💛 - Coveralls

@Cryoris Cryoris added this pull request to the merge queue Sep 11, 2024
Merged via the queue into stable/1.2 with commit e51a5cd Sep 11, 2024
17 checks passed
@mergify mergify bot deleted the mergify/bp/stable/1.2/pr-13086 branch September 11, 2024 12:35
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 conflicts used by mergify when there are conflicts in a port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants