Predefined decomposers
We refer to a decomposition as being predefined when each instance of a particular gate in the circuit, e.g., the CNOT gate, is replaced with a fixed gate or list of gates.
Three predefined decomposers are available in OpenSquirrel:
- CNOT to CZ decomposer
- SWAP to CNOT decomposer
- SWAP to CZ decomposer
SWAP decomposition
The latter two SWAP decomposers, are currently the only available decomposers in OpenSquirrel that can decompose the SWAP gate. The general two-qubit decomposers, e.g., the CNOT decomposer and CZ decomposer do not decompose the SWAP gate.
CNOT to CZ decomposer
The decomposition of the CNOT gate into a CZ gate (with additional single-qubit gates) is used frequently.
To this end a CNOT to CZ decomposer (CNOT2CZDecomposer) has been implemented that decomposes any CNOTs in a circuit
to a Ry(-π/2), a CZ, and Ry(π/2) gate, in that order; with the single-qubit gates acting on the target qubit.
The decomposition is illustrated in the image below.
Ry gates are used instead of, e.g., Hadamard gates, as they are, generally, more likely to be supported already by target backends.
SWAP to CNOT decomposer
The SWAP to CNOT decomposer (SWAP2CNOTDecomposer) implements the predefined decomposition of the SWAP gate into 3
CNOT gates.
The decomposition is illustrated in the image below.
SWAP to CZ decomposer
The SWAP to CZ decomposer (SWAP2CZDecomposer) implements the predefined decomposition of the SWAP gate into Ry
rotations and 3 CZ gates.
The decomposition is illustrated in the image below.





