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

Adjusting Clifford condition in gates.GPI2 #1399

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Adjusting Clifford condition in gates.GPI2 #1399

merged 2 commits into from
Jul 29, 2024

Conversation

MatteoRobbiati
Copy link
Contributor

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@MatteoRobbiati MatteoRobbiati changed the title feat: cliffordizing GPI2 according to parameter Adjusting clifford condition in GPI2 Jul 22, 2024
@renatomello renatomello added the enhancement New feature or request label Jul 24, 2024
@renatomello renatomello added this to the Qibo 0.2.10 milestone Jul 24, 2024
@scarrazza scarrazza modified the milestones: Qibo 0.2.10, Qibo 0.2.11 Jul 24, 2024
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.99%. Comparing base (d8cc501) to head (8513ff0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1399   +/-   ##
=======================================
  Coverage   99.99%   99.99%           
=======================================
  Files          78       78           
  Lines       11192    11195    +3     
=======================================
+ Hits        11191    11194    +3     
  Misses          1        1           
Flag Coverage Δ
unittests 99.99% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@renatomello renatomello left a comment

Choose a reason for hiding this comment

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

Before merging: did anyone check if the GPI2 is actually a Clifford in those parameters?

@AlejandroSopena
Copy link
Contributor

Yes, it is because $GPI2(0)=\sigma_x$, $GPI2(\pi/2)=\sigma_y$, $GPI2(\pi)=-\sigma_x$ and $GPI2(3\pi/2)=-\sigma_y$, where $\sigma_j$ are the Pauli matrices.

@renatomello
Copy link
Contributor

Yes, it is because GPI2(0)=σx, GPI2(π/2)=σy, GPI2(π)=−σx and GPI2(3π/2)=−σy, where σj are the Pauli matrices.

I don't see it from the $GPI2$ matrix representation.

@AlejandroSopena
Copy link
Contributor

AlejandroSopena commented Jul 29, 2024

Sorry, you are right. This happens for the GPI gate but not for GPI2.
It can be checked that it is a Clifford with the following code:

paulis = [gates.X(0).matrix(), gates.Y(0).matrix(), gates.Z(0).matrix()]
for p in paulis:
    for t in [0, np.pi/2, np.pi, 3*np.pi/2, 2*np.pi]:
        gate = gates.GPI2(0, t).matrix()
        gate1 = gate@p@gate.transpose().conj()
        print(gate1)

@alecandido
Copy link
Member

That's an error: GPI2 is always a rotation by $\pi/2$, not $\pi$. So, they are square roots of Pauli's.

E.g., cf. https://ionq.com/docs/getting-started-with-native-gates#gpi2

@AlejandroSopena
Copy link
Contributor

In the previous code I was printing gate instead of gate1. Now it can be seen that it maps paulis to paulis up to phases.

@renatomello renatomello added this pull request to the merge queue Jul 29, 2024
Merged via the queue into master with commit 90fa948 Jul 29, 2024
27 checks passed
@renatomello renatomello deleted the gpi2_cliff branch July 29, 2024 12:34
@alecandido
Copy link
Member

@AlejandroSopena of course, my comment was referred not to the one directly above, but to the previous one, i.e. #1399 (comment)

@renatomello renatomello modified the milestones: Qibo 0.2.11, Qibo 0.2.10 Jul 29, 2024
@renatomello renatomello changed the title Adjusting clifford condition in GPI2 Adjusting Clifford condition in GPI2 Jul 30, 2024
@renatomello renatomello changed the title Adjusting Clifford condition in GPI2 Adjusting Clifford condition in gates.GPI2 Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants