three_qubit_gate_decomposer
ThreeQubitGateDecomposer
Bases: Decomposer
Source code in opensquirrel/passes/decomposer/three_qubit_gate_decomposer.py
decompose
Predefined decomposition of the three-qubit gates into CZ gates and single-qubit gates.
The Toffoli gate (CCX) is decomposed into 6 CZ gates and single-qubit rotations, which is the minimum possible according to Shende and Markov (2008). The Fredkin gate (CSWAP) is decomposed as a Toffoli gate conjugated by two CNOT gates, giving 8 CZ gates.
Note
This decomposition preserves the global phase of the three-qubit gate. Gates other than CCX and CSWAP are returned unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instruction
|
Gate
|
three-qubit gate to decompose. |
required |
Returns:
| Type | Description |
|---|---|
list[Gate]
|
A sequence of CZ gates and single-qubit gates that decompose the three-qubit gate. |