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

Use global phase intrinsic for R with PauliI to make application of phase more consistent #1450

Closed
Tracked by #1317
swernli opened this issue Apr 30, 2024 · 1 comment · Fixed by #1461
Closed
Tracked by #1317
Assignees
Labels
bug Something isn't working

Comments

@swernli
Copy link
Collaborator

swernli commented Apr 30, 2024

The current decompositions treat R with PauliI as identity, which can create confusion when comparing to mathematical behavior where Ri is expected to introduce a global phase. Instead, we should introduce a global phase intrinsic that is used during simulation to apply expected global phase changes and incorporate that into the behavior of the R1 gate as well. This global phase intrinsic should be treated as a no-op during compilation for hardware, so it is not a __quantum__qis__ intrinsic but rather a simulation specific intrinsic.

@swernli swernli added the bug Something isn't working label Apr 30, 2024
@swernli swernli self-assigned this Apr 30, 2024
@swernli
Copy link
Collaborator Author

swernli commented Apr 30, 2024

See #1317 (comment) and related discussion for a bunch more context.

swernli added a commit that referenced this issue May 1, 2024
This change introduces a new, stdlib-only intrinsic for applying global phase during simulation to make phase behavior more consisten and fixes #1450. This intrinsic only applies the global phase during simulation; the new `GlobalPhase` intrinsic is a no-op for QIR generation, circuit generation, and resource estimation. The change also includes updates to the stdlib and associated tests to account for the corrected global phase behavior.

This also fixes a bug in `DumpRegister` related to iteration through the state vector that ensures the "base" amplitude used for separating the state is consistently chosen, which avoids corner cases that could introduce a phase in the displayed output that wasn't present in the underlying state.
github-merge-queue bot pushed a commit that referenced this issue May 6, 2024
This change introduces a new, stdlib-only intrinsic for applying global
phase during simulation to make phase behavior more consisten and fixes
#1450. This intrinsic only applies the global phase during simulation;
the new `GlobalPhase` intrinsic is a no-op for QIR generation, circuit
generation, and resource estimation. The change also includes updates to
the stdlib and associated tests to account for the corrected global
phase behavior.

This also fixes a bug in `DumpRegister` related to iteration through the
state vector that ensures the "base" amplitude used for separating the
state is consistently chosen, which avoids corner cases that could
introduce a phase in the displayed output that wasn't present in the
underlying state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant