Skip to content

Commit

Permalink
Updates docstring of MZgate (#624)
Browse files Browse the repository at this point in the history
* Updates docstring of MZgate

* remove whitespaces

* remove whitespaces

* remove whitespaces

* remove whitespaces

* Adds extra line

* Adds extra line

* Adds end array

* Adds end array

* dedenting

* dedenting

* breaking equations

* breaking equations

* Adds break line
  • Loading branch information
nquesada committed Sep 10, 2021
1 parent 717e7a1 commit f5b5be6
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions strawberryfields/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,13 +1913,39 @@ class MZgate(Gate):
(R(\phi_{in})\otimes I) BS\left(\frac{\pi}{4}, \frac{\pi}{2}\right)
(R(\phi_{ex})\otimes I)
Args:
phi_in (float): internal phase
phi_ex (float): external phase
This gate becomes the identity for ``phi_in=np.pi`` and ``phi_ex=0``, and permutes the modes
for ``phi_in=0`` and ``phi_ex=0``.
It corresponds to an interferometer operation with unitary matrix
.. math::
U(\phi_{in}, \phi_{ex}) = \frac{1}{2} \left(\begin{array}{cc}
\left(-1+e^{i \phi_{in} }\right) e^{i \phi_{ex} } & i \left(1+e^{i \phi_{in} }\right)\\
i \left(1+e^{i \phi_{in} }\right) e^{i \phi_{ex} } & \left(1-e^{i \phi_{in} }\right)\\
\end{array}\right)
with special cases
.. math::
U(\pi, \pi) &= \left( \begin{array}{cc}
1 & 0 \\
0 & 1\\
\end{array}\right),\\
U(0, 0) &= i \left( \begin{array}{cc}
0 & 1 \\
1 & 0\\
\end{array}\right),\\
U(\pi/2, \phi_{ex}) &= -\frac{1}{\sqrt{2}} \left( \begin{array}{cc}
e^{i (\phi_{ex} -\tfrac{\pi}{4})} & e^{-i \tfrac{\pi}{4}} \\
e^{i (\phi_{ex} -\tfrac{\pi}{4})} & -e^{-i \tfrac{\pi}{4}}\\
\end{array}\right).
The last example corresponds to a 50/50 two-mode interferometer.
"""
ns = 2
Expand Down

0 comments on commit f5b5be6

Please sign in to comment.