Skip to content

ppvm_tableau::measure

measure

ppvm_tableau::measure

Z-basis measurement, including loss-aware variants.

classMeasureScratchsource

ppvm_tableau::measure::MeasureScratch

Bases: Clone, Default

Rust struct. Per-measurement scratch buffers, reused across qubits within a single `measure_all` invocation — and, when threaded through [`measure_all_with_scratch`](GeneralizedTableau::measure_all_with_scratch), across many shots of a sampler too. Reusing one scratch keeps the case-a HashMap and the b-entries Vec out of the per-shot allocator churn.

pub struct MeasureScratch<I, R>

Fields

NameTypeDescription
odd_phase_maskOption&lt;I&gt;
coeff_mapFxHashMap&lt;I, Complex&lt;R&gt;&gt;
b_entriesVec&lt;(I, Complex&lt;R&gt;)&gt;
  • `odd_phase_mask` is lazily computed and cached until the destabilizers change (i.e. until a case-a measurement runs `update_tableau_according_to_outcome`).
  • `coeff_map` is the case-a HashMap holding `(idx → amplitude)` between the overlap, partition, and merge passes.
  • `b_entries` is the case-a partition’s “k-bit = 1” scratch Vec.

Construct one per active sampling thread; the type is not meant to be shared across threads concurrently.

source

methodnewsource

ppvm_tableau::measure::MeasureScratch::new

pub fn new() -> Self

Returns

Self

source