cirq.kak_decomposition

cirq.kak_decomposition(unitary_object: Union[numpy.ndarray, cirq.SupportsUnitary], *, rtol: float = 1e-05, atol: float = 1e-08, check_preconditions: bool = True) → cirq.linalg.decompositions.KakDecomposition[source]

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

Parameters
  • 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.

Returns

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

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

Raises
  • 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