# cirq.so4_to_magic_su2s¶

cirq.so4_to_magic_su2s(mat: numpy.ndarray, *, rtol: float = 1e-05, atol: float = 1e-08, check_preconditions: bool = True) → Tuple[numpy.ndarray, numpy.ndarray][source]

Finds 2x2 special-unitaries A, B where mat = Mag.H @ kron(A, B) @ Mag.

Mag is the magic basis matrix:

1  0  0  i
0  i  1  0
0  i -1  0     (times sqrt(0.5) to normalize)
1  0  0 -i

Parameters: mat – A real 4x4 orthogonal matrix. rtol – Per-matrix-entry relative tolerance on equality. atol – Per-matrix-entry absolute tolerance on equality. check_preconditions – When set, the code verifies that the given matrix is from SO(4). Defaults to set. A pair (A, B) of matrices in SU(2) such that Mag.H @ kron(A, B) @ Mag is approximately equal to the given matrix. ValueError – Bad matrix.