Skip to content

Measurement sampling turns a probability distribution or quantum instrument into individual outcomes. It adds finite-shot uncertainty to an otherwise exact simulation. The central numerical task is to preserve the distinction between a state, a probability, an observed frequency, and a conditional postmeasurement state.

Helpful background. Density-matrix simulation supplies circuit states and branches.

Categorical sampling from Born probabilities

Section titled “Categorical sampling from Born probabilities”

For computational-basis measurement, pb=∣ψb∣2p_b=|\psi_b|^2 or pb=ρbbp_b=\rho_{bb}. Form cumulative sums Fb=∑j≤bpjF_b=\sum_{j\leq b}p_j, draw uu uniformly in [0,1)[0,1), and select the first bb with u<Fbu<F_b.

Check normalization and nonnegativity before forming the cumulative distribution. Remove only negligible roundoff-sized negatives with an explicit diagnostic; large negatives indicate an invalid state. Set the final cumulative endpoint to one after checking the total, to avoid an unassigned outcome caused by summation roundoff.

Use the strict inequality in the selection rule, including for repeated cumulative values from zero-probability bins. For example, probabilities (0,0.3,0,0.7)(0,0.3,0,0.7) have cumulative values (0,0.3,0.3,1)(0,0.3,0.3,1): u=0u=0 selects bin 1 and u=0.3u=0.3 selects bin 3 in zero-based numbering. A binary search must select the insertion point after equal cumulative values. This also avoids accidentally choosing a forbidden outcome when a generator returns exactly zero.

For measurement of a subsystem, sum over unmeasured indices first. The mapping from bitstring to integer must agree with the simulator’s qubit order. A one-hot state on each basis bit provides a better ordering test than a symmetric Bell state.

For an outcome operator MmM_m,

pm=Tr⁡(MmρMm†),ρm=MmρMm†pm.p_m=\operatorname{Tr}(M_m\rho M_m^\dagger), \qquad \rho_m=\frac{M_m\rho M_m^\dagger}{p_m}.

A general outcome can contain several Kraus operators, in which case sum their unnormalized contributions before normalizing. Sampling a Kraus label that the experiment does not resolve describes a finer record than the observer receives.

The POVM effect Em=∑αMmα†MmαE_m=\sum_\alpha M_{m\alpha}^\dagger M_{m\alpha} determines the probability Tr⁡(Emρ)\operatorname{Tr}(E_m\rho), but not the conditional state. For instance, the instruments with operators (∣0⟩⟨0∣,∣1⟩⟨1∣)(|0\rangle\langle0|,|1\rangle\langle1|) and (∣0⟩⟨0∣,∣0⟩⟨1∣)(|0\rangle\langle0|,|0\rangle\langle1|) have identical computational-basis probabilities. The second instrument resets the output to ∣0⟩|0\rangle for either outcome. A sampler that is given only POVM effects has insufficient information to continue an adaptive circuit.

An important unresolved-outcome example is a projective measurement with classical reporting errors. If the actual projectors are PbP_b and the report obeys the confusion matrix convention Cm∣bC_{m|b}, the map conditioned on report mm is

Jm(ρ)=∑bCm∣bPbρPb,ρm=Jm(ρ)Tr⁡Jm(ρ).\mathcal J_m(\rho)=\sum_b C_{m|b}P_b\rho P_b, \qquad \rho_m=\frac{\mathcal J_m(\rho)}{\operatorname{Tr}\mathcal J_m(\rho)}.

Thus a noisy report generally leaves a mixed conditional state. Generate the true outcome and its report if a simulation needs both, but provide only the report to an observer’s filter or controller. Collapsing directly onto the reported basis state would incorrectly turn a classical recording error into a different measurement disturbance.

For a pure projective measurement on one qubit, zero inconsistent amplitudes and normalize the surviving slice. A nearly zero-probability branch is ill-conditioned; never force it through a division by zero. Probabilities should determine which branches can actually be sampled.

For NN independent shots, count nbn_b and estimate p^b=nb/N\hat p_b=n_b/N. Multinomial covariance is

Cov⁡(p^a,p^b)=paδab−papbN.\operatorname{Cov}(\hat p_a,\hat p_b) =\frac{p_a\delta_{ab}-p_ap_b}{N}.

Histogram bins are anticorrelated because their probabilities sum to one. For a ±1\pm1 observable, the mean estimator has variance (1−⟨A⟩2)/N(1-\langle A\rangle^2)/N.

A zero count does not establish zero probability. With no observed events, a one-sided confidence bound at level 1−α1-\alpha is p≤1−α1/Np\leq1-\alpha^{1/N}, approximately −log⁡α/N-\log\alpha/N for large NN. This exact binomial statement is preferable to the misleading zero standard error from substituting p^=0\hat p=0 into a Gaussian formula.

For (∣00⟩+∣11⟩)/2(|00\rangle+|11\rangle)/\sqrt2, only 00 and 11 occur, each with probability one half. Each individual qubit is random, while the parity is exactly even. Test all three facts. A simulator that samples each qubit independently from its marginal produces incorrect 01 and 10 outcomes.

For terminal measurements, evolve once and draw repeated outcomes from the same exact distribution. For adaptive circuits, conditional collapse and later gates must be simulated in sequence, as described in density-matrix circuits.

Record the pseudorandom generator and seed policy. Parallel jobs must use independent streams. Repeated output from identical seeds is not an enlarged independent data set.

Samples from a slowly drifting device model or a Markov chain are correlated. Use independent runs or an appropriate effective-sample-size analysis; the ordinary N−1/2N^{-1/2} formula assumes independence. When comparing two simulators, exact probability differences can reveal bias much more efficiently than comparing two noisy histograms.

How many zero-event independent shots are needed for a 95% one-sided upper bound below 10−310^{-3}?

Solution

Require 1−0.051/N≤10−31-0.05^{1/N}\leq10^{-3}, or N≥log⁡(0.05)/log⁡(0.999)≈2994.2N\geq\log(0.05)/\log(0.999)\approx2994.2. Thus 2995 zero-event shots suffice. This conclusion applies to the specified Bernoulli event and does not automatically provide simultaneous bounds for many histogram bins.

  • Clopper, C. J., and Pearson, E. S., “The use of confidence or fiducial limits illustrated in the case of the binomial,” Biometrika 26, 404–413 (1934), doi:10.1093/biomet/26.4.404.
  • Watrous, J., The Theory of Quantum Information, Cambridge University Press (2018), author’s text — measurement probabilities and quantum instruments.