liveBook · Manning

Quantum amplitude estimation

As explained in Building Quantum Software with Python

Quantum amplitude estimation is a quantum algorithm that estimates the probability or count associated with marked outcomes by estimating a rotation angle of a Grover operator.

Quantum amplitude estimation estimates the combined probability, or under equal probabilities the count, of marked outcomes. Instead of relying only on repeated measurements, it estimates the rotation angle induced by a Grover operator, using additional qubits and a more complex computation. section 9.6.1 section 9.7

Build the procedure around a state-preparation circuit A and an oracle O:

  • Prepare an n-qubit estimation register with Hadamard gates and an m-qubit target register with A. section 9.6.1
  • Construct the Grover iterate G = A M₀ A⁻¹ O and apply controlled powers G²ᵏ for each estimation qubit. section 9.6.1
  • Apply the inverse quantum Fourier transform to the estimation register, measure repeatedly, and select the most frequent estimation value v. section 9.6.1
  • Convert v into a probability estimate with sin²(vπ/2ⁿ), or use the corresponding count formula when outcomes are equally likely. section 9.6.1

Estimating two marked outcomes

Prepare a three-qubit state with a randomly generated circuit, mark outcomes 0 and 1, and run amplitude estimation with n = 8 estimation qubits. The measured dominant value v = 37 produces an estimated probability of 0.1924, compared with the directly computed probability 0.1897666121194554. section 9.6.3

Figure 9.27 The amplitude estimation diagram where A is an m-qubit circuit and G is a Grover operator constructed using an m-qubit oracle circuit
figure

Use the circuit diagram to trace the estimation register, target register, state-preparation circuit A, controlled Grover iterates, and inverse quantum Fourier transform. section 9.6.1

Listing 9.5 Function to create the amplitude estimation circuit
from algo import grover_iterate_circuit

def amplitude_estimation_circuit(n, A, O, swap=True):
    c = QuantumRegister(n)
    q = QuantumRegister(sum(A.regs))
    qc = QuantumCircuit(c, q)

    for i in range(n):
        qc.h(c[i])

    qc.append(A, q)

    for i in range(n):
        for _ in range(2**i):
            if swap:
                qc.c_append(grover_iterate_circuit(A, O), c[i], q)        #1
            else:
                qc.c_append(grover_iterate_circuit(A, O), c[n-1-i], q)   

    qc.iqft(c if swap else c[::-1], swap)

    return qc

Use the circuit-building function to implement register creation, controlled Grover-iterate repetitions, optional register-order swaps, and the inverse quantum Fourier transform. section 9.6.1

How Building Quantum Software with Python covers it

How deep it goes
Explains register preparation, controlled Grover powers, IQFT, measurement, and conversion formulas while deferring mathematical proofs.
Examples
Uses a random three-qubit state, marked outcomes 0 and 1, eight estimation qubits, and the estimate v = 37.
What it assumes
Uses quantum Fourier transforms, phase estimation structure, quantum registers, state preparation, and oracle circuits.
What you can do after
Build it from scratch with a state-preparation circuit and oracle, then compute a marked-outcome probability or count.
How it connects
Connects quantum phase estimation, Grover operators, inverse quantum Fourier transforms, and quantum counting.

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.