|q⟩ Bad Qubits

advanced · Programming · Advanced VQE & Ansatz Design

Measurement Grouping

A realistic molecular Hamiltonian decomposes into hundreds or thousands of Pauli terms. Measuring each one in its own circuit — preparing the trial state, rotating, sampling, repeating — is the dominant cost of VQE. Measurement grouping slashes that cost by measuring many terms from a single circuit. The key fact: terms that commute share a common eigenbasis, so one measurement in that basis estimates them all.

Commuting families

Two observables AA and BB can be measured simultaneously if and only if [A,B]=0[A, B] = 0. For Pauli strings there are two useful notions of commutation:

From terms to cliques

Decide which terms can share a measurement, then partition the term set into as few groups as possible. Build a graph whose vertices are Pauli terms and whose edges connect commuting pairs; a valid grouping is a partition into cliques (fully-connected subsets). Minimizing the number of groups is the minimum clique cover problem. It is NP-hard in general, but cheap greedy colorings (Verteletskyi et al.) already cut the number of distinct measurement circuits by large factors on real molecules.

Reading several expectations from one histogram

Suppose you measure two qubits in the ZZ basis and obtain probabilities P(00),P(01),P(10),P(11)P(00), P(01), P(10), P(11). From this one distribution you can read off three expectation values, using the sign rule Z0=+0Z|0\rangle = +|0\rangle, Z1=1Z|1\rangle = -|1\rangle:

Z0=P(00)+P(01)P(10)P(11),\langle Z_0\rangle = P(00) + P(01) - P(10) - P(11), Z1=P(00)P(01)+P(10)P(11),\langle Z_1\rangle = P(00) - P(01) + P(10) - P(11), Z0Z1=P(00)P(01)P(10)+P(11).\langle Z_0 Z_1\rangle = P(00) - P(01) - P(10) + P(11).

Three terms, one circuit. Scaled up to a clique of dozens of commuting terms, this is exactly where the savings come from.

Try it

Prepare the trial state with RY(π/3)R_Y(\pi/3) on qubit 0 and RY(π/2)R_Y(\pi/2) on qubit 1, then measure both qubits in the computational basis. The grader checks the full measurement distribution — the single histogram from which all of Z0\langle Z_0\rangle, Z1\langle Z_1\rangle, and Z0Z1\langle Z_0Z_1\rangle can be reconstructed.

Run your code to see the quantum state.

After running, open the Probabilities tab and verify by hand that Z1=P(0)P(1)=0\langle Z_1\rangle = P({*}0) - P({*}1) = 0, consistent with RY(π/2)R_Y(\pi/2) placing qubit 1 exactly on the equator.

Sign in on the full site to ask questions and join the discussion.