- Compilation/
PCPhase decomposition
PCPhase decomposition
The projector-controlled phase gate, qml.PCPhase
in PennyLane,
is a crucial component in quantum algorithms, particularly within the Quantum Singular Value
Transformation (QSVT) framework. This gate applies the same phase shift e^{i\phi} to the first d
computational basis states and its inverse e^{-i\phi} to the remaining 2^n-d basis states,
where n is the number of qubits the gate acts on. For d=3, the corresponding matrix reads
Here, we present an original and highly optimized decomposition of qml.PCPhase
into controlled phase shift gates.
Inputs
qml.PCPhase
gate, specified via the angle \phi, the dimension d, and the number of qubits n.
Outputs
- Decomposition of the gate in terms of (controlled) phase shift gates
(
qml.PhaseShift
) in PennyLane.
Example
Consider a projector-controlled phase gate with \phi=1.45, d=13 and n=4:
import pennylane as qml
phi = 1.45
op = qml.PCPhase(phi, d=13, wires=[0, 1, 2, 3])
The decomposition discussed here is implemented in PennyLane:
print(qml.draw(op.decomposition)())
0: ──GlobalPhase(-1.45)─╭●────────╭●──────────┤
1: ──GlobalPhase(-1.45)─╰Rϕ(-2.9)─├●──────────┤
2: ──GlobalPhase(-1.45)───────────├○──────────┤
3: ──GlobalPhase(-1.45)──X────────╰Rϕ(2.9)──X─┤
As we can see, this yields controlled versions of qml.PhaseShift
, which
can be decomposed further, for example, into controlled Pauli rotations as described on the
compilation page for controlled phase shifts.
Before we dive into the technical details, let's collect a few observations about this decomposition that might come in handy:
- Except for the Pauli-X gates, all gates in the decomposition are diagonal, just like
PCPhase
. - The number of controls on the phase shift gates differ by at least two, so that for n qubits,
there are at most \lceil \tfrac{n}{2}\rceil (controlled) phase shift gates in the decomposition.
To be precise, there are \|d\oplus (3d)\|\leq\lceil\log_2(\sqrt{3d/2})\rceil
(multi-controlled)
qml.PhaseShift
gates, where \|\cdot\| denotes the Hamming weight and \oplus denotes bitwise XOR. - Control nodes of different phase shift gates on the same qubit are of the same type (
○
controlling on the state |0\rangle or●
controlling on the state |1\rangle). - The rotation angles, or phases, in the
PhaseShift
gates are all equal, up to a sign, and equal to \pm 2\phi, where \phi is the angle of thePCPhase
gate. - For n qubits and d=2^k for some integer k, which is a frequent scenario in applications,
the decomposition contains a single (n-k-1)-fold controlled
PhaseShift
gate.
Typical usage
The projector-controlled phase gate typically appears in QSVT workflows, and it needs to be decomposed into more elementary gates to enable its implementation on hardware. This makes the decomposition presented here useful in all QSVT workflows. Other decompositions are possible, in particular when considering auxiliary wires [1].
References
[1] "A Grand Unification of Quantum Algorithms", John M. Martyn, Zane M. Rossi, Andrew K. Tan, Isaac L. Chuang, PRX Quantum, 2021, DOI:10.1103/PRXQuantum.2.040203
Cite this page
@misc{PennyLane-PCPhase-Decomp, title = "PCPhase decomposition", author = "David Wierichs", year = "2025", howpublished = "\url{https://pennylane.ai/compilation/pcphase-decomp}" }
Page author(s)
David Wierichs
I like to think about differentiation and representations of quantum programs, and I enjoy coding up research ideas and useful features for anyone to use in PennyLane.