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 standalone test file for Clifford synthesis functions #12347

Merged
merged 6 commits into from
May 7, 2024

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented May 6, 2024

Summary

This PR is a spin-off from #12203 with a few minor improvements to the synthesis functions:

  • Moving Clifford synthesis tests to a standalone file in test/python/synthesis instead of test/python/quantum_info
  • A proposal to avoid cyclic import errors in synthesis files (this allows to freely import DAGCircuit inside qiskit.synthesis in Add support for high level synthesis plugins to return a DAGCircuit #12203, which would normally raise a cyclic import error)
  • Adding copy=False to circuit.append

Details and comments

@ElePT ElePT added the Changelog: None Do not include in changelog label May 6, 2024
@ElePT ElePT requested review from alexanderivrii, ShellyGarion and a team as code owners May 6, 2024 08:34
@qiskit-bot
Copy link
Collaborator

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

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia

@ElePT ElePT added this to the 1.2.0 milestone May 6, 2024
@coveralls
Copy link

coveralls commented May 6, 2024

Pull Request Test Coverage Report for Build 8982134163

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 39 of 40 (97.5%) changed or added relevant lines in 9 files are covered.
  • 75 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.004%) to 89.629%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/library/pauli_evolution.py 3 4 75.0%
Files with Coverage Reduction New Missed Lines %
qiskit/circuit/library/generalized_gates/unitary.py 1 91.46%
crates/qasm2/src/expr.rs 1 94.03%
qiskit/synthesis/clifford/clifford_decompose_ag.py 2 96.15%
crates/qasm2/src/lex.rs 3 91.86%
qiskit/converters/init.py 7 72.0%
crates/accelerate/src/sparse_pauli_op.rs 18 93.27%
crates/qasm2/src/parse.rs 18 96.69%
crates/qasm3/src/circuit.rs 25 78.06%
Totals Coverage Status
Change from base Build 8966020047: -0.004%
Covered Lines: 62258
Relevant Lines: 69462

💛 - Coveralls

Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thank you very much -- this makes the code cleaner and more efficient (in particular avoiding to copy the subcircuits in clifford synthesis algorithms). My only real suggestion was to move the random clifford generation circuit directly to Qiskit (and remove its support for V and W gates that are not available in the standard library). Of course, that also means that you would need the release notes :).

test/python/synthesis/test_clifford_sythesis.py Outdated Show resolved Hide resolved
tools/pgo_scripts/test_utility_scale.py Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM!

@alexanderivrii alexanderivrii added this pull request to the merge queue May 7, 2024
Merged via the queue into Qiskit:main with commit 6ff0eb5 May 7, 2024
15 checks passed
ElePT added a commit to ElePT/qiskit that referenced this pull request May 31, 2024
* Convert synthesis imports to runtime imports to avoid cyclic import errors

* Set copy=False in append

* Move clifford synthesis tests to separate file in test/synthesis.

* Add random_clifford_circuit to qiskit.circuit.random

* Remove pylint disable

* Fix reno
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants