zz_phase

guppylang.std.qsystem.zz_phase(q1: qubit, q2: qubit, angle: angle) None[source]

zz_phase gate command.

zz_phase(q1, q2, theta)

Qubit ordering: [q1, q2]

\[\begin{split}\mathrm{ZZPhase}(\theta)= \exp(\frac{- i \theta}{2}\big(Z \otimes Z \big))= \begin{pmatrix} e^{\frac{-i \theta}{2}} & 0 & 0 & 0 \\ 0 & e^{\frac{i \theta}{2}} & 0 & 0 \\ 0 & 0 & e^{\frac{i \theta}{2}} & 0 \\ 0 & 0 & 0 & e^{\frac{-i \theta}{2}} \end{pmatrix}\end{split}\]
>>> @guppy
... def qsystem_cx(q1: qubit, q2: qubit) -> None:
...     phased_x(angle(3/2), angle(-1/2), q2)
...     zz_phase(q1, q2, angle(1/2))
...     rz(angle(5/2), q1)
...     phasedx(angle(-3/2), q1)
...     rz(angle(3/2), q2)
>>> qsystem_cx.compile()