Decomposes a two-qubit operation into ZPow/XPow/YPow/sqrt-iSWAP gates.

Used in the notebooks

Used in the tutorials

This method uses the KAK decomposition of the matrix to determine how many sqrt-iSWAP gates are needed and which single-qubit gates to use in between each sqrt-iSWAP.

All operations can be synthesized with exactly three sqrt-iSWAP gates and about 79% of operations (randomly chosen under the Haar measure) can also be synthesized with two sqrt-iSWAP gates. Only special cases locally equivalent to identity or sqrt-iSWAP can be synthesized with zero or one sqrt-iSWAP gates respectively. Unless required_sqrt_iswap_count is specified, the fewest possible number of sqrt-iSWAP will be used.

q0 The first qubit being operated on.
q1 The other qubit being operated on.
mat Defines the operation to apply to the pair of qubits.
required_sqrt_iswap_count When specified, exactly this many sqrt-iSWAP gates will be used even if fewer is possible (maximum 3). Raises ValueError if impossible.
use_sqrt_iswap_inv If True, returns a decomposition using SQRT_ISWAP_INV gates instead of SQRT_ISWAP. This decomposition is identical except for the addition of single-qubit Z gates.
atol A limit on the amount of absolute error introduced by the construction.
check_preconditions If set, verifies that the input corresponds to a 4x4 unitary before decomposing.
clean_operations Merges runs of single qubit gates to a single cirq.PhasedXZGate in the resulting operations list.

A list of operations implementing the matrix including at most three SQRT_ISWAP (sqrt-iSWAP) gates and ZPow, XPow, and YPow single-qubit gates.

ValueError If required_sqrt_iswap_count is specified, the minimum number of sqrt-iSWAP gates needed to decompose the given matrix is greater than required_sqrt_iswap_count.

Towards ultra-high fidelity quantum operations: SQiSW gate as a native two-qubit gate