cirq.linalg.kron_factor_4x4_to_2x2s

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.

matrix The 4x4 unitary matrix to factor.

A scalar factor and a pair of 2x2 unit-determinant matrices. The kronecker product of all three is equal to the given matrix.

ValueError The given matrix can't be tensor-factored into 2x2 pieces.