cirq.kak_decomposition

cirq.kak_decomposition(mat: numpy.ndarray, tolerance: cirq.linalg.tolerance.Tolerance = Tolerance(rtol=1e-05, atol=1e-08, equal_nan=False)) → cirq.linalg.decompositions.KakDecomposition[source]

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

Parameters:
  • mat – The 4x4 unitary matrix to decompose.
  • tolerance – Per-matrix-entry tolerance on equality.
Returns:

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

0 ≤ abs(z) ≤ y ≤ x ≤ π/4 z ≠ -π/4

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