-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 documentation on OpenQASM 2 phase conventions #10801
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenQASM 2 as a language does not provide a way to specify global phases, either of operations or the entire program. The prose of the defining paper talks about the `u1` and `rz` instructions from `qelib1.inc` as having different global phases, however since the language cannot represent this, the header file defines `rz` apparently as a direct alias to `u1`. Qiskit's position has always been that we interpret `rz` as using the phase convention of `RZGate`, and `u1` uses the different convention of `PhaseGate`. This commit adds documentation to the pages on OpenQASM 2 about this difference, and includes an example of how to override Qiskit's default if the generating code (e.g. pyZX) wants to use an alternative phase convention.
jakelishman
added
documentation
Something is not clear or an error documentation
stable backport potential
The bug might be minimal and/or import enough to be port to stable
mod: qasm2
Relating to OpenQASM 2 import or export
Changelog: None
Do not include in changelog
labels
Sep 8, 2023
One or more of the the following people are requested to review this:
|
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Cryoris
approved these changes
Sep 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍🏻
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Sep 28, 2023
mergify bot
pushed a commit
that referenced
this pull request
Sep 28, 2023
* Add documentation on OpenQASM 2 phase conventions OpenQASM 2 as a language does not provide a way to specify global phases, either of operations or the entire program. The prose of the defining paper talks about the `u1` and `rz` instructions from `qelib1.inc` as having different global phases, however since the language cannot represent this, the header file defines `rz` apparently as a direct alias to `u1`. Qiskit's position has always been that we interpret `rz` as using the phase convention of `RZGate`, and `u1` uses the different convention of `PhaseGate`. This commit adds documentation to the pages on OpenQASM 2 about this difference, and includes an example of how to override Qiskit's default if the generating code (e.g. pyZX) wants to use an alternative phase convention. * Comment on the number of overrides needed Co-authored-by: Julien Gacon <gaconju@gmail.com> --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> (cherry picked from commit 10461f1)
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 28, 2023
* Add documentation on OpenQASM 2 phase conventions OpenQASM 2 as a language does not provide a way to specify global phases, either of operations or the entire program. The prose of the defining paper talks about the `u1` and `rz` instructions from `qelib1.inc` as having different global phases, however since the language cannot represent this, the header file defines `rz` apparently as a direct alias to `u1`. Qiskit's position has always been that we interpret `rz` as using the phase convention of `RZGate`, and `u1` uses the different convention of `PhaseGate`. This commit adds documentation to the pages on OpenQASM 2 about this difference, and includes an example of how to override Qiskit's default if the generating code (e.g. pyZX) wants to use an alternative phase convention. * Comment on the number of overrides needed Co-authored-by: Julien Gacon <gaconju@gmail.com> --------- Co-authored-by: Julien Gacon <gaconju@gmail.com> (cherry picked from commit 10461f1) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
rupeshknn
pushed a commit
to rupeshknn/qiskit
that referenced
this pull request
Oct 9, 2023
* Add documentation on OpenQASM 2 phase conventions OpenQASM 2 as a language does not provide a way to specify global phases, either of operations or the entire program. The prose of the defining paper talks about the `u1` and `rz` instructions from `qelib1.inc` as having different global phases, however since the language cannot represent this, the header file defines `rz` apparently as a direct alias to `u1`. Qiskit's position has always been that we interpret `rz` as using the phase convention of `RZGate`, and `u1` uses the different convention of `PhaseGate`. This commit adds documentation to the pages on OpenQASM 2 about this difference, and includes an example of how to override Qiskit's default if the generating code (e.g. pyZX) wants to use an alternative phase convention. * Comment on the number of overrides needed Co-authored-by: Julien Gacon <gaconju@gmail.com> --------- Co-authored-by: Julien Gacon <gaconju@gmail.com>
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
documentation
Something is not clear or an error documentation
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
OpenQASM 2 as a language does not provide a way to specify global phases, either of operations or the entire program. The prose of the defining paper talks about the
u1
andrz
instructions fromqelib1.inc
as having different global phases, however since the language cannot represent this, the header file definesrz
apparently as a direct alias tou1
.Qiskit's position has always been that we interpret
rz
as using the phase convention ofRZGate
, andu1
uses the different convention ofPhaseGate
. This commit adds documentation to the pages on OpenQASM 2 about this difference, and includes an example of how to override Qiskit's default if the generating code (e.g. pyZX) wants to use an alternative phase convention.Details and comments
See the discussion in #10790.
Also I fixed a couple of typos that have been annoying me in the documentation, since I had it open.