Finds orthogonal matrices L, R such that L @ matrix @ R is diagonal.

mat A unitary matrix.
rtol Relative numeric error threshold.
atol Absolute numeric error threshold.
check_preconditions If set, verifies that the input is a unitary matrix (to the given tolerances). Defaults to set.

A triplet (L, d, R) such that L @ mat @ R = diag(d). Both L and R will be orthogonal matrices with determinant equal to 1.

ValueError Matrices don't meet preconditions (e.g. not real).