quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
454 stars 73 forks source link

add BLOCH gate & fix DEFGATE parsing bug #750

Closed stylewarning closed 2 years ago

stylewarning commented 2 years ago

add a new BLOCH gate for specifying a Bloch-sphere rotation (useful for typing random 1q unitaries)

notmgsk commented 2 years ago

Oh derp I missed that bit 🙈

On Oct 23, 2021, at 4:36 PM, Eric Peterson @.***> wrote:

 @ecpeterson commented on this pull request.

In src/quil/stdgates.quil:

@@ -157,3 +157,8 @@ DEFGATE CAN(%alpha, %beta, %gamma): 0, (cis((%alpha+%beta+%gamma)/(-2))+cis((%beta+%gamma-%alpha)/2))/2, (cis((%alpha+%beta+%gamma)/(-2))-cis((%beta+%gamma-%alpha)/2))/2, 0 0, (cis((%alpha+%beta+%gamma)/(-2))-cis((%beta+%gamma-%alpha)/2))/2, (cis((%alpha+%beta+%gamma)/(-2))+cis((%beta+%gamma-%alpha)/2))/2, 0 (cis((%alpha-%beta+%gamma)/2)-cis((%alpha+%beta-%gamma)/2))/2, 0, 0, (cis((%alpha+%beta-%gamma)/2)+cis((%alpha-%beta+%gamma)/2))/2 + +DEFGATE BLOCH(%a, %b, %c) q AS PAULI-SUM:

  • X(%a) q Nope! PAULI-SUM means this is short for exp(-i (X * %a + …)).

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

stylewarning commented 2 years ago

Things are still broken because the final DEFGATE isn't parsed. So I'll fix that and add tests.

stylewarning commented 2 years ago

Tests pass locally. Fixed a parsing bug. Ready for re-review.