MZI#

class discopy.quantum.optics.MZI(theta, phi, _dagger=False)[source]#

Bases: Box

Mach-Zender interferometer.

Corresponds to Matrix \(\begin{pmatrix} e^{2\pi i \phi} \tt{sin}(\theta \, \pi) & \tt{cos}(\theta \, \pi) \\ e^{2\pi i \phi} \tt{cos}(\theta \, \pi) & - \tt{sin}(\theta \, \pi) \end{pmatrix}\).

Parameters:
  • theta (float) – Internal phase parameter, ranging from 0 to 1.

  • phi (float) – External phase parameter, ranging from 0 to 1.

Example

>>> assert np.allclose(MZI(0.28, 0).array, TBS(0.28).array)
>>> assert np.isclose(MZI(0.28, 0.3).global_phase, TBS(0.28).global_phase)
>>> assert np.isclose(MZI(0.12, 0.3).global_phase.conjugate(),
...                   MZI(0.12, 0.3).dagger().global_phase)
>>> mach = lambda x, y: TBS(x) >> Phase(y) @ Id(1)
>>> assert np.allclose(MZI(0.28, 0.9).array, mach(0.28, 0.9).array)
>>> assert np.allclose((MZI(0.28, 0.34) >> MZI(0.28, 0.34).dagger()).array,
...                    Id(2).array)