cirq.linalg.kak_decomposition

Decomposes a 2-qubit unitary into 1-qubit ops and XX/YY/ZZ interactions.

unitary_object The value to decompose. Can either be a 4x4 unitary matrix, or an object that has a 4x4 unitary matrix (via the cirq.SupportsUnitary protocol).
rtol Per-matrix-entry relative tolerance on equality.
atol Per-matrix-entry absolute tolerance on equality.
check_preconditions If set, verifies that the input corresponds to a 4x4 unitary before decomposing.

A cirq.KakDecomposition canonicalized such that the interaction coefficients x, y, z satisfy:

0 ≤ abs(z2) ≤ y2 ≤ x2 ≤ π/4 if x2 = π/4, z2 >= 0

ValueError Bad matrix.
ArithmeticError Failed to perform the decomposition.

References:

'An Introduction to Cartan's KAK Decomposition for QC Programmers' https://arxiv.org/abs/quant-ph/0507171