Skip to main content

Module expectation

Module expectation 

Source
Expand description

Pauli-string expectation values and pattern traces. Pauli-string expectation values for GeneralizedTableau.

Two entry points:

  • GeneralizedTableau::expectation — single-Pauli ⟨ψ|P|ψ⟩ for a PauliWord. Conjugates P through the tableau and overlaps the resulting Pauli with the sparse coefficient vector using the same formulas as the measurement code.
  • GeneralizedTableau::trace — Σ_{P matches pattern} ⟨ψ|P|ψ⟩ for a PauliPattern. Enumerates the matching Paulis and sums their expectations.

Decision 9 in the multi-backend plan calls these out as the natural primitive for the tableau backend; semantics intentionally diverge from the PauliSum trace.