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

Implement __array__ for qasm2._DefinedGate #12119

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

jakelishman
Copy link
Member

Summary

Gates defined from OpenQASM 2 should have a well-defined matrix form (up to global phase) whenever all the constituent parts of the definition do. This manually makes such a matrix available.

Details and comments

Fix #12100.

Gates defined from OpenQASM 2 should have a well-defined matrix form (up
to global phase) whenever all the constituent parts of the definition
do. This manually makes such a matrix available.
@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog mod: qasm2 Relating to OpenQASM 2 import or export labels Apr 2, 2024
@jakelishman jakelishman added this to the 1.0.3 milestone Apr 2, 2024
@jakelishman jakelishman requested a review from a team as a code owner April 2, 2024 16:22
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Apr 2, 2024

Pull Request Test Coverage Report for Build 9098528425

Details

  • 5 of 6 (83.33%) changed or added relevant lines in 1 file are covered.
  • 26 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 89.605%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/qasm2/parse.py 5 6 83.33%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
crates/qasm2/src/lex.rs 6 91.86%
crates/qasm2/src/parse.rs 18 96.23%
Totals Coverage Status
Change from base Build 9097424317: -0.03%
Covered Lines: 62295
Relevant Lines: 69522

💛 - Coveralls

qiskit/qasm2/parse.py Outdated Show resolved Hide resolved
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.

This LGTM now, but I'm going to hold off on auto merging it to stable/1.1 for 1.1.0. I think it's a bit out of scope for backport at this point. We can discuss it for 1.1.1 (I think we might want to just hold it for 1.2.0)

@mtreinish mtreinish modified the milestones: 1.1.0, 1.1.1 May 16, 2024
@mtreinish mtreinish added this pull request to the merge queue Jun 6, 2024
Merged via the queue into Qiskit:main with commit 767bd07 Jun 6, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request Jun 6, 2024
* Implement `__array__` for `qasm2._DefinedGate`

Gates defined from OpenQASM 2 should have a well-defined matrix form (up
to global phase) whenever all the constituent parts of the definition
do. This manually makes such a matrix available.

* Fix signature for Numpy 2.0

(cherry picked from commit 767bd07)
@jakelishman jakelishman deleted the qasm2/to-matrix branch June 6, 2024 15:26
github-merge-queue bot pushed a commit that referenced this pull request Jun 6, 2024
* Implement `__array__` for `qasm2._DefinedGate`

Gates defined from OpenQASM 2 should have a well-defined matrix form (up
to global phase) whenever all the constituent parts of the definition
do. This manually makes such a matrix available.

* Fix signature for Numpy 2.0

(cherry picked from commit 767bd07)

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Procatv pushed a commit to Procatv/qiskit-terra-catherines that referenced this pull request Aug 1, 2024
* Implement `__array__` for `qasm2._DefinedGate`

Gates defined from OpenQASM 2 should have a well-defined matrix form (up
to global phase) whenever all the constituent parts of the definition
do. This manually makes such a matrix available.

* Fix signature for Numpy 2.0
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 mod: qasm2 Relating to OpenQASM 2 import or export stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XXPlusYYGate.to_matrix() fails after qasm2 roundtrip
4 participants