cirq.so4_to_magic_su2s¶
-
cirq.so4_to_magic_su2s(mat: numpy.ndarray, tolerance: cirq.linalg.tolerance.Tolerance = Tolerance(rtol=1e-05, atol=1e-08, equal_nan=False)) → 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.
- tolerance – Per-matrix-entry tolerance on equality.
Returns: A pair (A, B) of matrices in SU(2) such that Mag.H @ kron(A, B) @ Mag is approximately equal to the given matrix.
Raises: ValueError– Bad matrix.ArithmeticError– Failed to perform the decomposition to desired tolerance.