cirq.kron_factor_4x4_to_2x2s

cirq.kron_factor_4x4_to_2x2s(matrix: numpy.ndarray) → Tuple[complex, numpy.ndarray, numpy.ndarray][source]

Splits a 4x4 matrix U = kron(A, B) into A, B, and a global factor.

Requires the matrix to be the kronecker product of two 2x2 unitaries.
Requires the matrix to have a non-zero determinant.
Giving an incorrect matrix will cause garbage output.
Parameters:matrix – The 4x4 unitary matrix to factor.
Returns:A scalar factor and a pair of 2x2 unit-determinant matrices. The kronecker product of all three is equal to the given matrix.
Raises:ValueError – The given matrix can’t be tensor-factored into 2x2 pieces.