We're celebrating World Quantum Day 2022! Join us

Module: cirq.linalg.decompositions

Utility methods for breaking matrices into useful pieces.


class AxisAngleDecomposition: Represents a unitary operation as an axis, angle, and global phase.

class KakDecomposition: A convenient description of an arbitrary two-qubit operation.


axis_angle(...): Decomposes a single-qubit unitary into axis, angle, and global phase.

deconstruct_single_qubit_matrix_into_angles(...): Breaks down a 2x2 unitary into more useful ZYZ angle parameters.

extract_right_diag(...): Extract a diagonal unitary from a 3-CNOT two-qubit unitary.

kak_canonicalize_vector(...): Canonicalizes an XX/YY/ZZ interaction by swap/negate/shift-ing axes.

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

kak_vector(...): Compute the KAK vectors of one or more two qubit unitaries.

kron_factor_4x4_to_2x2s(...): Splits a 4x4 matrix U = kron(A, B) into A, B, and a global factor.

map_eigenvalues(...): Applies a function to the eigenvalues of a matrix.

num_cnots_required(...): Returns the min number of CNOT/CZ gates required by a two-qubit unitary.

scatter_plot_normalized_kak_interaction_coefficients(...): Plots the interaction coefficients of many two-qubit operations.

so4_to_magic_su2s(...): Finds 2x2 special-unitaries A, B where mat = Mag.H @ kron(A, B) @ Mag.

unitary_eig(...): Gives the guaranteed unitary eigendecomposition of a normal matrix.

KAK_GAMMA Instance of numpy.ndarray
KAK_MAGIC Instance of numpy.ndarray
KAK_MAGIC_DAG Instance of numpy.ndarray
MAGIC Instance of numpy.ndarray
MAGIC_CONJ_T Instance of numpy.ndarray
T Instance of typing.TypeVar
YY Instance of numpy.ndarray