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

Qasm for pauli X sqrts #4113

Merged
merged 21 commits into from
Jun 18, 2021
Merged

Qasm for pauli X sqrts #4113

merged 21 commits into from
Jun 18, 2021

Conversation

stubbi
Copy link
Contributor

@stubbi stubbi commented May 17, 2021

addresses #3728

The issue mentions to check other stabilizer operations like X**-0.5, Y0.5, Y-0.5, Z**0.5 too. According to the qiskit docs, there exist only X**0.5 as xs and X**-0.5 as xsdg. Both of these conversions have been implemented and tests are passing locally.

@stubbi stubbi requested review from cduck, vtomole and a team as code owners May 17, 2021 15:54
@stubbi stubbi requested a review from tanujkhattar May 17, 2021 15:54
@google-cla
Copy link

google-cla bot commented May 17, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label May 17, 2021
@google-cla google-cla bot added cla: yes Makes googlebot stop complaining. and removed cla: no labels May 17, 2021
@stubbi
Copy link
Contributor Author

stubbi commented May 17, 2021

@googlebot I fixed it.

@stubbi stubbi closed this May 17, 2021
@stubbi
Copy link
Contributor Author

stubbi commented May 17, 2021

closing for now, got to fix the coverage check

@stubbi stubbi reopened this May 17, 2021
@tanujkhattar
Copy link
Collaborator

It looks stabilizer_simulator supports sx, s, sdg but not sxdg.

  1. For ZPowGate; cirq.Z ** 0.5 currently outputs rz(pi*0.5) but should output s. Similarly cirq.Z ** -0.5 should output sdg.

  2. For XPowGate; I'm not sure why their simulator does not support sxdg. Maybe @Strilanc can comment what should be expected behaviour here.

Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

FYI, if we transpile a circuit withsxdg to the stabilizer_simulator backend, it decomposes sxdg to SHS. Maybe we should directly output this decomposition for cirq.X ** -0.5 ?

In [2]: circ = QuantumCircuit(2)
    ...: circ.sx(0)
    ...: circ.sxdg(1)
    ...: print(circ)
    ...: simulator = Aer.get_backend('aer_simulator_stabilizer')
    ...: circ = transpile(circ, simulator)
    ...: print(circ)
      ┌────┐
q_0: ─┤ √X ├─
     ┌┴────┴┐
q_1: ┤ √XDG ├
     └──────┘
global phase: -π/4
     ┌────┐
q_0: ┤ √X ├──────────
     ├───┬┘┌───┐┌───┐
q_1: ┤ S ├─┤ H ├┤ S ├
     └───┘ └───┘└───┘

In the meantime, please make the changes for cirq.ZPowGate.

@stubbi
Copy link
Contributor Author

stubbi commented May 18, 2021

@tanujkhattar thanks for your review, good catches!

I added the requested changes for the ZPowGate and opened an issue in qiskit-aer to ask if the sxdg isn't included on purpose or had been overlooked.

I would propose to revert the changes for XPowGate(-0.5) for now and wait for a reply in the qiskit issue to see if we have to change its output to sxdg or s h s. What do you think?

@stubbi stubbi requested a review from tanujkhattar May 26, 2021 18:51
@tanujkhattar
Copy link
Collaborator

Sounds good, Please revert the changes to sxdg and update the original issue with the details (let's keep it open so we can track the progress on the qiskit issue).

@stubbi
Copy link
Contributor Author

stubbi commented Jun 8, 2021

@tanujkhattar I reverted the changes for sxdg and left a comment in the issue

Copy link
Collaborator

@tanujkhattar tanujkhattar left a comment

Choose a reason for hiding this comment

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

LGTM

@tanujkhattar tanujkhattar added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jun 18, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jun 18, 2021
@CirqBot CirqBot merged commit ef5ae03 into quantumlib:master Jun 18, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jun 18, 2021
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
addresses quantumlib#3728 

The issue mentions to [check other stabilizer operations like X**-0.5, Y**0.5, Y**-0.5, Z**0.5 too](quantumlib#3728 (comment)). According to the [qiskit docs](https://qiskit.org/documentation/apidoc/circuit_library.html), there exist only `X**0.5` as `xs` and `X**-0.5` as `xsdg`. Both of these conversions have been implemented and tests are passing locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants