Decompositions

QuantumFlow Gate Decompositions

One-qubit gate decompositions

quantumflow.bloch_decomposition(gate: Gate) Circuit

Converts a 1-qubit gate into a Rn gate, a 1-qubit rotation of angle theta about axis (nx, ny, nz) in the Bloch sphere.

Returns:

A Circuit containing a single Rn gate

quantumflow.zyz_decomposition(gate: Gate) Circuit

Returns the Euler Z-Y-Z decomposition of a local 1-qubit gate.

quantumflow.euler_decomposition(gate: Gate, euler: str = 'ZYZ') Circuit

Returns an Euler angle decomposition of a local 1-qubit gate .

The ‘euler’ argument can be used to specify any of the 6 Euler decompositions: ‘XYX’, ‘XZX’, ‘YXY’, ‘YZY’, ‘ZXZ’, ‘ZYZ’ (Default)

Two-qubit gate decompositions

quantumflow.kronecker_decomposition(gate: Gate, euler: str = 'ZYZ') Circuit

Decompose a 2-qubit unitary composed of two 1-qubit local gates.

Uses the “Nearest Kronecker Product” algorithm. Will give erratic results if the gate is not the direct product of two 1-qubit gates.

quantumflow.canonical_decomposition(gate: Gate, euler: str = 'ZYZ') Circuit

Decompose a 2-qubit gate by removing local 1-qubit gates to leave the non-local canonical two-qubit gate. [1] [2] [3] [4]

Returns: A Circuit of 3 operations: a circuit of initial 1-qubit gates; a canonical gate, with coordinates in the Weyl chamber; and a final circuit contains the final 1-qubits gates.

The canonical coordinates can be found in circ.elements[2].params

More or less follows the algorithm outlined in [2].

quantumflow.canonical_coords(gate: Gate) Sequence[float]

Returns the canonical coordinates of a 2-qubit gate

quantumflow.cnot_decomposition(gate: Gate) Circuit

Decompose any 2-qubit gate into a circuit of (at most) three CNot gates.

Ref:

Optimal Quantum Circuits for General Two-Qubit Gates, Vatan & Williams (2004) (quant-ph/0308006) Fig. 6

quantumflow.b_decomposition(gate: Gate) Circuit

Decompose any 2-qubit gate into a sandwich of two B gates.

Refs:

Minimum construction of two-qubit quantum operations https://arxiv.org/abs/quant-ph/0312193