PennyLane
Install
Install
  1. Compilation/
  2. Phase gradient

Phase gradient

OverviewState propertiesPhase gradient rotationsControl rotationsMultiplexed rotationsResources

We will briefly outline a few properties of the most commonly used phase gradient state, which we will denote as |\nabla\rangle or |\nabla_b\rangle for a specific number of qubits b. We will use the following characterization as the definition:

|\nabla_b\rangle = \frac{1}{\sqrt{B}} \sum_{k=0}^{B-1} e^{-2\pi i\tfrac{k}{B}} |k\rangle,

where we denoted B=2^b.

This state is actually a product state, and can alternatively be written as

|\nabla_b\rangle = \otimes_{j=1}^{b} \frac{1}{\sqrt{2}} (|0\rangle + e^{-i\tfrac{2\pi}{2^j}} |1\rangle).

The phase gradient state |\nabla_b\rangle is a product state.

State preparation

The product state representation above allows us to figure out a simple state preparation routine for |\nabla_b\rangle: each qubit is put into the |+\rangle state and then its |1\rangle component is phase shifted by \exp(-i\tfrac{2\pi}{2^j}) for the j-1-st qubit:

0:   ──H──Rϕ(-2π/2)───┤
1:   ──H──Rϕ(-2π/4)───┤
2:   ──H──Rϕ(-2π/8)───┤
3:   ──H──Rϕ(-2π/16)──┤
            .
            .
b-1: ──H──Rϕ(-2π/2^b)─┤

The phase gradient state |\nabla_b\rangle can be prepared by applying phase shifts with angles \{-\frac{2\pi}{2^j}\}_{j=1}^{b} to a register in the state |+\rangle^{\otimes b}.

Traditionally, the phase gradient state above is related to the quantum Fourier transform (QFT), because it is the second column of the matrix representation of the QFT. Due to the specific initial state, however, it can be greatly simplified to the circuit above.

Phase gradients and addition

An important property of |\nabla_b\rangle for their use in implementing rotation gates is the following:

\operatorname{Add}_M |\nabla_b\rangle = e^{2\pi i \tfrac{M}{B}}|\nabla_b\rangle,

where \operatorname{Add}_M denotes addition by an integer M, modulo B=2^b. That is, adding to a phase gradient state only results in a global phase, but otherwise leaves the state intact.

The phase gradient state |\nabla_b\rangle is an eigenstate of addition.

In the following, we briefly derive this fact:

\begin{align} \operatorname{Add}_M |\nabla_b\rangle &=\operatorname{Add}_M\left[\frac{1}{\sqrt{B}} \sum_{k=0}^{B-1} e^{-2\pi i\tfrac{k}{B}} |k\rangle\right]\\ &=\frac{1}{\sqrt{B}} \sum_{k=0}^{B-1} e^{-2\pi i\tfrac{k}{B}} |(k+M)\!\!\mod B\rangle\\ &=\frac{1}{\sqrt{B}} \sum_{k'=M}^{B-1+M} e^{-2\pi i\tfrac{k'-M}{B}} |k'\!\!\mod B\rangle\\ &=e^{2\pi i \tfrac{M}{B}} \frac{1}{\sqrt{B}} \left[\sum_{k'=M}^{B-1} e^{-2\pi i\tfrac{k'}{B}} |k'\rangle + \sum_{k'=0}^{M-1} e^{-2\pi i\tfrac{k'}{B}} e^{-2\pi i}|k'\rangle\right]\\ &= e^{2\pi i \tfrac{M}{B}}|\nabla_b\rangle. \end{align}

Here we shifted the summation index via k'=k+M and used e^{-2\pi i}=1. We will sometimes write |\nabla_b + M\rangle as a shorthand for such a shifted state.

The calculation demonstrates the relationship between the phases in the phase gradient state and addition modulo B; performing addition on the state shifts the computational basis state against the group of phases. This can then be reversed by extracting an overall phase, matching each computational basis state with its original phase. Note that this is only possible because the phases are distributed equally across the group U(1)=\{\exp(i\varphi) | \varphi\in [0,2\pi)\}.

Copying

A useful consequence of the relationship between addition and phase gradient states from above is that we can duplicate such states, replacing costly phase shifts by addition, or subtraction to be precise. For this, note what happens if we subtract a register of size b that is in a uniform superposition of two computational basis states |\ell_0\rangle, |\ell_1\rangle from a register in the phase gradient state |\nabla_b\rangle:

\begin{align} \operatorname{Add}^\dagger \frac{1}{\sqrt{2}}(|\ell_0\rangle+|\ell_1\rangle)\otimes|\nabla_b\rangle &=\frac{1}{\sqrt{2}} (|\ell_0\rangle \otimes |\nabla_b-\ell_0\rangle + |\ell_1\rangle \otimes |\nabla_b-\ell_1\rangle)\\ &=\frac{1}{\sqrt{2}} (e^{-2\pi i\tfrac{\ell_0}{B}} |\ell_0\rangle + e^{-2\pi i\tfrac{\ell_1}{B}} |\ell_1\rangle) \otimes |\nabla_b\rangle. \end{align}

As we can see, the linearity of \operatorname{Add} leads to the respective phase simply being applied to each computational basis state individually. Consequently, if we prepare the first register in the state |+\rangle^{\otimes b} and then apply \operatorname{Add}^\dagger, each computational basis state is present and receives the correct phase to make up a phase gradient state again.

(Semi in-place) subtraction copies phase gradient states.

|+>    : ──╭(SemiAdder)†─┤ ╮
|+>    : ──├(SemiAdder)†─┤ │
|+>    : ──├(SemiAdder)†─┤ ├ |∇_b>
|+>    : ──├(SemiAdder)†─┤ │
|+>    : ──├(SemiAdder)†─┤ │
|+>    : ──├(SemiAdder)†─┤ ╯
      ╭: ──├(SemiAdder)†─┤ ╮
      │: ──├(SemiAdder)†─┤ │
|∇_b> ┤: ──├(SemiAdder)†─┤ ├ |∇_b>
      │: ──├(SemiAdder)†─┤ │
      │: ──├(SemiAdder)†─┤ │
      ╰: ──╰(SemiAdder)†─┤ ╯

Copying a phase gradient state with b qubits costs 4b-4 T gates if at least b-1 clean auxiliary qubits are available, using Gidney's adder [2].

PennyLane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Built by researchers, for research. Created with ❤️ by Xanadu.

Research

  • Research
  • Performance
  • Hardware & Simulators
  • Demos
  • Quantum Compilation
  • Quantum Datasets

Education

  • Teach
  • Learn
  • Codebook
  • Coding Challenges
  • Videos
  • Glossary

Software

  • Install PennyLane
  • Features
  • Documentation
  • Catalyst Compilation Docs
  • Development Guide
  • API
  • GitHub
Stay updated with our newsletter

© Copyright 2025 | Xanadu | All rights reserved

TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.

Privacy Policy|Terms of Service|Cookie Policy|Code of Conduct