cirq.kak_decomposition

cirq.kak_decomposition(mat: numpy.ndarray, rtol: float = 1e-05, atol: float = 1e-08) → 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.
  • rtol – Per-matrix-entry relative tolerance on equality.
  • atol – Per-matrix-entry absolute 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