microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
465 stars 93 forks source link

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

Closed swernli closed 7 months ago

swernli commented 7 months ago

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 commented 7 months ago

See https://github.com/microsoft/qsharp/issues/1317#issuecomment-2084567948 and related discussion for a bunch more context.