rectangular(V, tol=1e-11)[source]

Rectangular decomposition of a unitary matrix, with local phase shifts applied between two interferometers.

See Rectangular decomposition or [23] for more details.

This function returns a circuit corresponding to an intermediate step in the decomposition as described in Eq. 4 of the article. In this form, the circuit comprises some T matrices (as in Eq. 1), then phases on all modes, and more T matrices.

The procedure to construct these matrices is detailed in the supplementary material of the article.

  • V (array[complex]) – unitary matrix of size n_size

  • tol (float) – the tolerance used when checking if the matrix is unitary: \(|VV^\dagger-I| \leq\) tol


tuple of the form (tilist,np.diag(localV),tlist)


  • tilist: list containing [n,m,theta,phi,n_size] of the Ti unitaries needed

  • tlist: list containing [n,m,theta,phi,n_size] of the T unitaries needed

  • localV: Diagonal unitary sitting sandwiched by Ti’s and the T’s

Return type