sun_compact(U, rtol=1e-12, atol=1e-12)[source]

Recursive factorization of unitary transfomations.

Decomposes elements of \(\mathrm{SU}(n)\) as a sequence of \(\mathrm{SU}(2)\) transformations and entangling beamsplitters, see [24]. This sequence of \(\mathrm{SU}(2)\) transformations can then be mapped to an operation on optical modes including two phase plates and one beam splitter.

This implementation is based on the authors’ code at github:glassnotes/Caspar.

  • U (array) – unitary matrix

  • rtol (float) – relative tolerance used when checking if the matrix is unitary

  • atol (float) – absolute tolerance used when checking if the matrix is unitary


Returns a list of operations with elements in the form (i,i+1), [a, b, g] where the (i,i+1) indicates the modes of an \(\mathrm{SU}(2)\) transformation and [a, b, g] are the transformation parameters.

Return type

tuple[list[tuple,list], float]

Note that any unitary can be written in terms of an special unitary as

\[U = e^{i \phi/n} S\]

where \(S \in \mathrm{SU}(n)\) and \(e^{i\phi} = \mathrm{det}\,U\).

Here any \(S \in \mathrm{SU}(n)\) is parametrized in terms of the Euler angles and written as

\[\begin{split}S(\alpha, \beta, \gamma) = \begin{pmatrix} e^{i\alpha/2} & 0 \\ 0 & e^{-i\alpha/2} \end{pmatrix} \begin{pmatrix} \cos{\beta/2} & -\sin{\beta/2} \\ \sin{\beta/2} & \cos{\beta/2} \end{pmatrix} \begin{pmatrix} e^{i\gamma/2} & 0 \\ 0 & e^{-i\gamma/2} \end{pmatrix}.\end{split}\]

This factorization then determines the constructions of the \(\mathrm{SU}(2)\) device acting on the respective optical modes

\[S(\alpha, \beta, \gamma) = \left[ R(\alpha/2) \otimes R(-\alpha/2) \right] \, BS(\beta/2) \, \left[ R(\gamma/2) \otimes R(-\gamma/2) \right].\]