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

Issue #4182 Initializer should use at most 2^(n+1)-2n cnots #4183

Merged
merged 12 commits into from
Jun 18, 2020

Conversation

adjs
Copy link
Contributor

@adjs adjs commented Apr 19, 2020

Summary

Fix #4182 Initializer should use at most $2^(n+1)$-2n cnots

Details and comments

Optimizations described in arXiv:quant-ph/0406176

  1. Reverse the second multiplexor
  2. Remove the last cnot of each multiplexor if two multiplexors are applied sequentially.

@ismaila-at-za-ibm
Copy link
Contributor

ismaila-at-za-ibm commented Apr 22, 2020

As far as I recall, both these optimizations were implemented three years ago.

EDIT: Oops, I relooked at the paper and see that I missed this optimization. Indeed a version of this optimization was implemented within a multiplexed Rz or Ry call, but the paper shows that the same optimization can be made between two "neighbouring" multiplexed Rz and Ry calls.

Thank you for spotting this.

@Cryoris Cryoris requested a review from jaygambetta as a code owner May 4, 2020 07:41
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, I think for @ismaila-at-za-ibm as well as from the comment above. @ajavadia or @kdk could you have a final look and approve if it is alright for you?

@Cryoris Cryoris linked an issue May 4, 2020 that may be closed by this pull request
@mergify mergify bot requested a review from a team as a code owner June 18, 2020 04:15
@mergify mergify bot merged commit 0bc68df into Qiskit:master Jun 18, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
…skit#4183)

* reverse multiplexed Ry

* simplifying cnots

* simplifying cnots

* simplify last cnot

* test initializer number of  cnots

* fix style

* numbers which test failed for the old implementation

Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@mtreinish mtreinish added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Aug 6, 2020
@adjs adjs deleted the initialize branch May 10, 2021 17:42
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initializer should use at most 2^(n+1)-2n cnots
5 participants