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 DiagonalGate QPY serialisation #10376

Merged
merged 9 commits into from
Jul 10, 2023
Merged

Fix DiagonalGate QPY serialisation #10376

merged 9 commits into from
Jul 10, 2023

Conversation

Raghav-Bell
Copy link
Contributor

@Raghav-Bell Raghav-Bell commented Jul 3, 2023

Added "diagonal" in line 282

Summary

Diagonal gate is causing error as discussed in issue #10364 . This PR closes the issue #10364

Details and comments

As suggested by @jakelishman , i have added "diagonal" at line 282.

Fix #10364.

Added "diagonal" in line 282
@Raghav-Bell Raghav-Bell requested a review from a team as a code owner July 3, 2023 18:04
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jul 3, 2023
@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
  • @nkanazawa1989

@jakelishman
Copy link
Member

Thanks for looking at this! Please can you add a test case and a "bug fix" release note (see the contributing guide in the repo root for information on that).

@jakelishman jakelishman added Changelog: Bugfix Include in the "Fixed" section of the changelog mod: qpy Related to QPY serialization labels Jul 3, 2023
@Raghav-Bell
Copy link
Contributor Author

@jakelishman I have added release notes using reno but i am new to tox can you please help me in adding test cases.

@rht
Copy link
Contributor

rht commented Jul 4, 2023

@Raghav-Bell you can do so by adding FourierChecking to https://github.com/Qiskit/qiskit-terra/blob/8a8609f93a600019bf208610a348adcbe61e3acd/test/qpy_compat/test_qpy.py#L577 (or a simpler circuit that has DiagonalGate). You should go through the functions generate_*_circuit. Read https://github.com/Qiskit/qiskit-terra/blob/main/CONTRIBUTING.md#test for running the tests locally.

@jakelishman
Copy link
Member

Thanks @rht! The test/qpy_compat place is the backwards-compatibility tests for QPY; those are actually a little tricky to run locally, but it would be good to add a case to them (protected on Terra version >= (0, 25, 0), since that's when we'll release the fix). You can also add a regular unit test to test/python/qpy/test_circuit_load_from_qpy.py, which are all just regular unittest tests.

@jakelishman jakelishman changed the title Updated circuits.py (Added "diagonal" at line 282) Fix DiagonalGate QPY serialisation Jul 4, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Jul 4, 2023
@jakelishman
Copy link
Member

(btw, the lint is failing with a style error - if you pip install tox, you can tox -e black to fix it up automatically.)

@Raghav-Bell
Copy link
Contributor Author

I have tested for diagonal gate test using tox -ep310 -- generate* and tox -ep310 -- diag* both ends succesfully. Complete tests take alot time ,hence i hv dropped .

jakelishman
jakelishman previously approved these changes Jul 10, 2023
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Thanks for this! I fixed up the release note a little and moved the test into the regular unit tests (there's a complication with DiagonalGate itself that will make it hard to use our QPY backwards-compatibility tests for now).

mtreinish
mtreinish previously approved these changes Jul 10, 2023
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, this seems straightforward enough

@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jul 10, 2023
@mtreinish mtreinish enabled auto-merge July 10, 2023 15:48
@jakelishman jakelishman modified the milestones: 0.25.0, 0.24.2 Jul 10, 2023
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5510413486

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 17 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.005%) to 85.981%

Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 80.0%
crates/qasm2/src/lex.rs 3 91.65%
crates/qasm2/src/parse.rs 12 96.65%
Totals Coverage Status
Change from base Build 5490783039: -0.005%
Covered Lines: 71634
Relevant Lines: 83314

💛 - Coveralls

@mtreinish mtreinish added this pull request to the merge queue Jul 10, 2023
Merged via the queue into Qiskit:main with commit 20ee6ec Jul 10, 2023
13 checks passed
mergify bot pushed a commit that referenced this pull request Jul 10, 2023
* Update circuits.py

Added "diagonal" in line 282

* added release notes/add-diagonal-to-DiagonalGate-c945e0f8adcd2940

* corrected reformatting using tox

* Added test for diagonal gate.

* Move test to regular unit tests

* Fix DiagonalGate check

* Fixup release note

* Fix test typo

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
(cherry picked from commit 20ee6ec)
github-merge-queue bot pushed a commit that referenced this pull request Jul 10, 2023
* Update circuits.py

Added "diagonal" in line 282

* added release notes/add-diagonal-to-DiagonalGate-c945e0f8adcd2940

* corrected reformatting using tox

* Added test for diagonal gate.

* Move test to regular unit tests

* Fix DiagonalGate check

* Fixup release note

* Fix test typo

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
(cherry picked from commit 20ee6ec)

Co-authored-by: Raghav <83136390+Raghav-Bell@users.noreply.github.com>
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: qpy Related to QPY serialization stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
Status: Done
6 participants