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 inverse of UCGate #8508

Merged
merged 12 commits into from
Aug 14, 2022
Merged

Fix global phase in inverse of UCGate #8508

merged 12 commits into from
Aug 14, 2022

Conversation

israelferrazaraujo
Copy link
Contributor

Summary

The inverse() of the UCGate class is defined by simply inverting the existing decomposition, but the inverse of the global phase was missing.

Details and comments

The existing tests did not cover the inverse() function of the UCGate class, so I also included a new test.

The inverse of UCGate is defined by simply inverting the existing decomposition, but the inverse of the global phase was missing.
@israelferrazaraujo israelferrazaraujo requested a review from a team as a code owner August 10, 2022 05:45
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

@CLAassistant
Copy link

CLAassistant commented Aug 10, 2022

CLA assistant check
All committers have signed the CLA.

test/python/circuit/test_uc.py Outdated Show resolved Hide resolved
test/python/circuit/test_uc.py Outdated Show resolved Hide resolved
@Cryoris
Copy link
Contributor

Cryoris commented Aug 10, 2022

Thanks for the fix! Could you also add a releasenote? 🙂

@adjs
Copy link
Contributor

adjs commented Aug 10, 2022

Thanks, @israelferrazaraujo. This PR also makes Isometry decomposition phase correct #4687.

@israelferrazaraujo
Copy link
Contributor Author

Thanks for the fix! Could you also add a releasenote? slightly_smiling_face

Hi @Cryoris,
I have added the release notes.

@Cryoris Cryoris changed the title Bugfix ucgate Fix global phase in inverse of UCGate and Isometry Aug 11, 2022
@Cryoris Cryoris 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 labels Aug 11, 2022
@coveralls
Copy link

coveralls commented Aug 11, 2022

Pull Request Test Coverage Report for Build 2845394035

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.003%) to 84.05%

Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 79.78%
Totals Coverage Status
Change from base Build 2845105967: -0.003%
Covered Lines: 56315
Relevant Lines: 67002

💛 - Coveralls

test/python/circuit/test_isometry.py Outdated Show resolved Hide resolved
test/python/circuit/test_isometry.py Outdated Show resolved Hide resolved
@Cryoris Cryoris changed the title Fix global phase in inverse of UCGate and Isometry Fix global phase in inverse of UCGate Aug 14, 2022
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks a lot for the contribution!

@Cryoris Cryoris merged commit 82c85d8 into Qiskit:main Aug 14, 2022
mergify bot pushed a commit that referenced this pull request Aug 14, 2022
* Defines the inverse of the global phase

The inverse of UCGate is defined by simply inverting the existing decomposition, but the inverse of the global phase was missing.

* Tests the UCGate.inverse() function

* Lint

* Seed for building the matrices

* Replace `unitary_simulator` by using `qiskit.quantum_info.Operator`.

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Import `Operator` class

* Release notes

* Lint

* Test the phase of isometry decomposition

* Removes the `prelude` from the release notes file

* Replaces `matrix_equal` with `np.allclose`

Co-authored-by: Julien Gacon <gaconju@gmail.com>
(cherry picked from commit 82c85d8)
@israelferrazaraujo
Copy link
Contributor Author

LGTM thanks a lot for the contribution!

It's good to contribute to Qiskit. I hope to do more in the future.

@israelferrazaraujo israelferrazaraujo deleted the bugfix-ucgate branch August 14, 2022 16:16
mergify bot added a commit that referenced this pull request Aug 17, 2022
* Defines the inverse of the global phase

The inverse of UCGate is defined by simply inverting the existing decomposition, but the inverse of the global phase was missing.

* Tests the UCGate.inverse() function

* Lint

* Seed for building the matrices

* Replace `unitary_simulator` by using `qiskit.quantum_info.Operator`.

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Import `Operator` class

* Release notes

* Lint

* Test the phase of isometry decomposition

* Removes the `prelude` from the release notes file

* Replaces `matrix_equal` with `np.allclose`

Co-authored-by: Julien Gacon <gaconju@gmail.com>
(cherry picked from commit 82c85d8)

Co-authored-by: Israel F. Araujo <israelferrazaraujo@hotmail.com>
Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
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.

6 participants