liveBook · Manning

Quantum phase estimation

As explained in Building Quantum Software with Python

A phase estimation circuit is a quantum circuit that generates a phase-encoded state from an eigenstate and a unitary transformation for estimating an eigenvalue phase.

Quantum phase estimation (QPE) estimates the phase angle attached to an eigenvalue of a circuit transformation. Given a circuit U and an eigenstate whose eigenvalue is cis(θ), QPE transfers that otherwise hidden rotation angle into a measurable frequency pattern. It is a reusable building block for algorithms including Shor’s algorithm and for amplitude-estimation applications such as quantum counting. section 9.0 section 9.2 section 9.7

The developer mental model is frequency decoding. A periodic quantum state encodes a frequency v, related to the phase by θ/(2π) = v/2^n for an n-qubit estimation register. After measurement, the most frequent integer outcome estimates v and therefore θ. Exact integer frequencies can produce an exact dominant outcome; non-integer frequencies produce an approximate distribution centered near the encoded value. section 9.1 section 9.7

Figure 9.17 The QPE algorithm where U is an m-qubit circuit and E prepares an eigenstate of the circuit
figure

Use the circuit diagram to distinguish the estimation register, which is measured, from the target register, which holds an eigenstate of U. section 9.3

Build a phase-estimation circuit in this order:

  • Allocate an n-qubit estimation register and a target register sized for U, then prepare an eigenstate of U in the target register. section 9.3
  • Apply Hadamard gates to the estimation register, creating the control superposition used to encode phase information. section 9.3
  • For estimation qubit k, apply controlled U to the target 2^k times. These controlled powers encode a geometric sequence of phase rotations. section 9.3 section 9.4
  • Optionally unprepare the target eigenstate, apply the inverse QFT to the estimation register, and measure that register to recover a frequency estimate. section 9.3 section 9.7

Estimating an RY rotation

For U = RY(2θ), prepare the single-qubit eigenstate with X followed by RX(−π/2). With three estimation qubits and θ = 4.7·2π/2^3, apply Hadamards and controlled RY(2θ) operations, repeating the controlled operation 2^i times for control qubit i. Unprepare the target, apply the IQFT, and inspect the resulting phased discrete sinc state to estimate the encoded frequency near 4.7 and thus the rotation angle. section 9.2 section 9.3 section 9.4

A reusable implementation takes the estimation-register size, the circuit whose rotation angle is sought, and an optional eigenstate-preparation circuit. It prepares the eigenstate when supplied, applies controlled circuit repetitions, optionally appends the inverse preparation circuit, then appends the IQFT. Without eigenstate preparation, the circuit instead produces a superposition of geometric-sequence states. section 9.4

Measurement can use the most frequent integer result, or compare the approximate magnitudes of the two most frequent consecutive outcomes for a refined estimate. More advanced estimation methods, including Maximum Likelihood Estimation, are deferred. Amplitude estimation extends the phase-estimation pattern to estimate good-outcome counts or probabilities, trading additional qubits and circuit complexity for fewer measurements. section 9.7

How Building Quantum Software with Python covers it

How deep it goes
Works through eigenstates, controlled circuit powers, IQFT decoding, and a reusable circuit function; defers advanced estimation methods.
Examples
Uses an RY(2θ) circuit, a prepared single-qubit eigenstate, three estimation qubits, and an encoded frequency of 4.7.
What it assumes
Assumes familiarity with the QFT while introducing eigenstates and eigenvalues in circuit terms.
What you can do after
Build it from scratch as a circuit that converts an eigenvalue phase into a measured frequency estimate.
How it connects
Connects eigenstates, eigenvalues, controlled operations, the inverse quantum Fourier transform, amplitude estimation, and Shor’s algorithm.

Also explained in

Compare how 2 books explain quantum phase estimation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.