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 global phase in OneQubitEulerDecomposer using PSX and ZSX basis and in Diagonal gate #5474

Merged
merged 12 commits into from
Jan 19, 2021

Conversation

georgios-ts
Copy link
Contributor

@georgios-ts georgios-ts commented Dec 7, 2020

Summary

PSX and ZSX basis use the same parameters as U1X basis. This means that there is a pi / 4 global phase discrepancy every time we use an SX gate instead of an Rx(pi/2) gate and phi / 2 every time we use a Rz(phi) instead of a P(phi).

Not resolved in #5248

Tracks also global phase in diagonal gate and resolves #5453.

Details and comments

Fixes also the global phase when simplifications can be made since:

  • Phase(phi).SX.Phase(pi).SX.Phase(lam) = exp(i pi / 2).Phase(phi + lam + pi)
  • Phase(phi).SX.Phase(-pi).SX.Phase(lam) = exp(i pi / 2).Phase(phi + lam - pi)

and

  • Phase(phi).SX.Phase(pi / 2).SX.Phase(lam) = Phase(phi + pi / 2).SX.Phase(lam + pi / 2)
  • Phase(phi).SX.Phase(-pi / 2).SX.Phase(lam) = exp(i pi / 2).Phase(phi - pi / 2).SX.Phase(lam - pi / 2)

and

  • Phase(phi).SX.Phase(3pi / 2).SX.Phase(lam) = exp(i pi / 2).Phase(phi + 3pi / 2).SX.Phase(lam + 3pi / 2)
  • Phase(phi).SX.Phase(-3pi / 2).SX.Phase(lam) = Phase(phi - 3pi / 2).SX.Phase(lam - 3pi / 2)

@georgios-ts georgios-ts requested a review from a team as a code owner December 7, 2020 13:22
@mtreinish mtreinish added Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable labels Dec 7, 2020
@kdk
Copy link
Member

kdk commented Dec 10, 2020

Will this resolve #5453 ?

@georgios-ts
Copy link
Contributor Author

Will this resolve #5453 ?

No. I believe this issue is related to u1, u2, u3 basis and the simplifications Optimize1qGates makes. Maybe this can be fixed with #5468

@georgios-ts georgios-ts changed the title Fix global phase in OneQubitEulerDecomposer using PSX and ZSX basis Fix global phase in OneQubitEulerDecomposer using PSX and ZSX basis and in Diagonal gate Dec 14, 2020
@ewinston
Copy link
Contributor

ewinston commented Dec 31, 2020

It might be good to add test conditions for angle arguments which use shorter decompositions.

@kdk kdk added the automerge label Jan 19, 2021
@mergify mergify bot merged commit e98d456 into Qiskit:master Jan 19, 2021
mergify bot pushed a commit that referenced this pull request Jan 19, 2021
…nd in Diagonal gate (#5474)

* fix global phase in OneQubitEulerDecomposer using PSX and ZSX basis

* minor fixes

* update tests

* update randomized test

* set global_phase=True

* track global phase in diagonal gate

* fix dimension

* add test for special cases of zsx psx decomposition.

* linting

Co-authored-by: ewinston <[email protected]>
Co-authored-by: Kevin Krsulich <[email protected]>
(cherry picked from commit e98d456)
mergify bot added a commit that referenced this pull request Jan 19, 2021
…nd in Diagonal gate (#5474) (#5652)

* fix global phase in OneQubitEulerDecomposer using PSX and ZSX basis

* minor fixes

* update tests

* update randomized test

* set global_phase=True

* track global phase in diagonal gate

* fix dimension

* add test for special cases of zsx psx decomposition.

* linting

Co-authored-by: ewinston <[email protected]>
Co-authored-by: Kevin Krsulich <[email protected]>
(cherry picked from commit e98d456)

Co-authored-by: georgios-ts <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@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 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.

Control of the diagonal gate not working properly
4 participants