optics#
This module is an implementation of linear optical circuits as diagrams built from beam splitters, phases and Mach-Zender interferometers.
One may compute the bosonic statistics of these devices using
Diagram.indist_prob() and the statistics for distinguishable or
partially distinguishable particles using Diagram.dist_prob() and
Diagram.pdist_prob(). Amplitudes for pairs of input and output
occupation numbers are computed using Diagram.amp() and the full
matrix of amplitudes over occupation numbers is obtained using
Diagram.eval().
One may also use the QPath calculus as defined in
https://arxiv.org/abs/2204.12985. The functor optics2path() decomposes
linear optical circuits into QPath diagrams. The functor zx2path()
turns instances of zx.Diagram into QPath diagrams
via the dual-rail encoding.
Example
>>> from discopy.quantum.optics import zx2path
>>> from discopy.quantum.zx import Z
>>> from discopy import drawing
>>> drawing.equation(Z(2, 1), zx2path(Z(2, 1)), symbol='->',
... draw_type_labels=False, figsize=(6, 4),
... path='docs/_static/imgs/optics-fusion.png')