decompositions¶
The decomposition package is a collection of gate decomposition / replacement rules which can be used by, e.g., the AutoReplacer engine.
Submodules¶
projectq.setups.decompositions.crz2cxandrz module¶
Registers a decomposition for controlled z-rotation gates.
It uses 2 z-rotations and 2 C^n NOT gates to achieve this gate.
projectq.setups.decompositions.entangle module¶
Registers a decomposition for the Entangle gate.
Applies a Hadamard gate to the first qubit and then, conditioned on this first qubit, CNOT gates to all others.
projectq.setups.decompositions.globalphase module¶
Registers a decomposition rule for global phases.
Deletes global phase gates (which can be ignored).
projectq.setups.decompositions.ph2r module¶
Registers a decomposition for the controlled global phase gate.
Turns the controlled global phase gate into a (controlled) phase-shift gate. Each time this rule is applied, one control can be shaved off.
projectq.setups.decompositions.qft2crandhadamard module¶
Registers a decomposition rule for the quantum Fourier transform.
Decomposes the QFT gate into Hadamard and controlled phase-shift gates (R).
Warning
The final Swaps are not included, as those are simply a re-indexing of quantum registers.
projectq.setups.decompositions.r2rzandph module¶
Registers a decomposition rule for the phase-shift gate.
Decomposes the (controlled) phase-shift gate using z-rotation and a global phase gate.
projectq.setups.decompositions.swap2cnot module¶
Registers a decomposition to achieve a Swap gate.
Decomposes a Swap gate using 3 CNOT gates, where the one in the middle features as many control qubits as the Swap gate has control qubits.
projectq.setups.decompositions.toffoli2cnotandtgate module¶
Registers a decomposition rule for the Toffoli gate.
Decomposes the Toffoli gate using Hadamard, T, Tdag, and CNOT gates.