decompositions¶
The decomposition package is a collection of gate decomposition / replacement rules which can be used by, e.g., the AutoReplacer engine.
projectq.setups.decompositions.arb1qubit2rzandry |
Registers the Z-Y decomposition for an arbitrary one qubit gate. |
projectq.setups.decompositions.barrier |
Registers a decomposition rule for barriers. |
projectq.setups.decompositions.carb1qubit2cnotrzandry |
Registers the decomposition of an controlled arbitary single qubit gate. |
projectq.setups.decompositions.cnu2toffoliandcu |
Registers a decomposition rule for multi-controlled gates. |
projectq.setups.decompositions.crz2cxandrz |
Registers a decomposition for controlled z-rotation gates. |
projectq.setups.decompositions.entangle |
Registers a decomposition for the Entangle gate. |
projectq.setups.decompositions.globalphase |
Registers a decomposition rule for global phases. |
projectq.setups.decompositions.ph2r |
Registers a decomposition for the controlled global phase gate. |
projectq.setups.decompositions.qft2crandhadamard |
Registers a decomposition rule for the quantum Fourier transform. |
projectq.setups.decompositions.r2rzandph |
Registers a decomposition rule for the phase-shift gate. |
projectq.setups.decompositions.rx2rz |
Registers a decomposition for the Rx gate into an Rz gate and Hadamard. |
projectq.setups.decompositions.ry2rz |
Registers a decomposition for the Ry gate into an Rz and Rx(pi/2) gate. |
projectq.setups.decompositions.swap2cnot |
Registers a decomposition to achieve a Swap gate. |
projectq.setups.decompositions.time_evolution |
Registers decomposition for the TimeEvolution gates. |
projectq.setups.decompositions.toffoli2cnotandtgate |
Registers a decomposition rule for the Toffoli gate. |
Submodules¶
projectq.setups.decompositions.arb1qubit2rzandry module¶
Registers the Z-Y decomposition for an arbitrary one qubit gate.
See paper “Elementary gates for quantum computing” by Adriano Barenco et al., arXiv:quant-ph/9503016v1. (Note: They use different gate definitions!) Or see theorem 4.1 in Nielsen and Chuang.
Decompose an arbitrary one qubit gate U into U = e^(i alpha) Rz(beta) Ry(gamma) Rz(delta). If a gate V is element of SU(2), i.e., determinant == 1, then V = Rz(beta) Ry(gamma) Rz(delta)
projectq.setups.decompositions.barrier module¶
Registers a decomposition rule for barriers.
Deletes all barriers if they are not supported.
projectq.setups.decompositions.carb1qubit2cnotrzandry module¶
Registers the decomposition of an controlled arbitary single qubit gate.
See paper “Elementary gates for quantum computing” by Adriano Barenco et al., arXiv:quant-ph/9503016v1. (Note: They use different gate definitions!) or Nielsen and Chuang chapter 4.3.
projectq.setups.decompositions.cnu2toffoliandcu module¶
Registers a decomposition rule for multi-controlled gates.
Implements the decomposition of Nielsen and Chuang (Fig. 4.10) which decomposes a C^n(U) gate into a sequence of 2 * (n-1) Toffoli gates and one C(U) gate by using (n-1) ancilla qubits and circuit depth of 2n-1.
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.rx2rz module¶
Registers a decomposition for the Rx gate into an Rz gate and Hadamard.
projectq.setups.decompositions.ry2rz module¶
Registers a decomposition for the Ry gate into an Rz and Rx(pi/2) 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.time_evolution module¶
Registers decomposition for the TimeEvolution gates.
An exact straight forward decomposition of a TimeEvolution gate is possible if the hamiltonian has only one term or if all the terms commute with each other in which case one can implement each term individually.
projectq.setups.decompositions.toffoli2cnotandtgate module¶
Registers a decomposition rule for the Toffoli gate.
Decomposes the Toffoli gate using Hadamard, T, Tdag, and CNOT gates.