quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Typo in docstring for GPI2 gate #6639

Closed oschwarze closed 1 month ago

oschwarze commented 3 months ago

There seems to be a typo in the docstring for the GPI2 gate:

https://github.com/quantumlib/Cirq/blob/ab967669caddc7da510dddc22c12e6c5747e9d85/cirq-ionq/cirq_ionq/ionq_native_gates.py#L101-L156

according to https://ionq.com/docs/getting-started-with-native-gates, the 10-component int the matrix should be $-i \exp{i \phi}$ and not $-i\exp(-i \phi)$

dstrain115 commented 2 months ago

Cirq cycn: Ionq folks, can you comment whether this should be positive or negative signed?

pavoljuhas commented 1 month ago

TODO(@pavoljuhas) - contact ionq folks about this

pavoljuhas commented 1 month ago

The suggestion looks good given the unitary matrix below - however the docstring seems to be missing the 2π factor. https://github.com/quantumlib/Cirq/blob/f5566b682ffe3fc2e865568e10238e7fb1630d47/cirq-ionq/cirq_ionq/ionq_native_gates.py#L120-L123

@Cynocracy or @splch - can you please confirm?

Cynocracy commented 1 month ago

@pavoljuhas can confirm, updating the comment to match the unitary function* sgtm.

The 2pi factor comes from, aiui, the phase argument being expressed in units of turns, and should be present in the doc string as well, if phi there is intended to be the phase argument

pavoljuhas commented 1 month ago

@Cynocracy - thanks for a quick response. Can you PTAL at #6694?