# sf.decompositions.rectangular_phase_end¶

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

Rectangular decomposition of a unitary matrix, with all local phase shifts placed after the interferometers.

See [23] for more details.

Final step in the decomposition of a given discrete unitary matrix. The output is of the form given in Eq. 5.

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

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

Returns

returns a tuple of the form (tlist, np.diag(localV), None)

where:

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

• localV: Diagonal unitary matrix to be applied at the end of circuit

Return type

tuple[array]