Observable compilation, decoding and statistics

Compilation pipeline

estimators.compile_observable converts public objects into immutable-style serializable descriptors with an ID, kind, basis and support information. The strict manifest validator reconstructs declarations and checks their model/geometry/source consistency. Only the supported class whitelist is compiled; arbitrary callbacks are not serialized into children.

Simple supports evaluate a binary parity at spatial slice zero of the source or dual engine. LocalX/PauliXString supports are dualized once; THooft supports are used directly. The measurement path obtains both a representative sign and its logical character. Product signs multiply and characters XOR before orbit averaging. Connected descriptors compile their two operator children and obtain the joint product character separately. Nested statistical functionals are refused.

Every physical higher-degree mean uses the conditional estimator in Exact spatial logical-bit marginalization. A raw representative bit is not a public physical mean of the collapsed ensemble. Decoder metadata such as raw sign, correction, fill size and rejection count remains distinct from the orbit-averaged value.

Local decoder geometry

collapsed_geometry.LocalLoopDecoder retains the reference deterministic rule of decoder.LoopDecoder and replaces whole-lattice adjacency construction with local incidence traversal:

  1. Grow a tube from the logical support using p-cells sharing an appropriate boundary or co-boundary check.

  2. Collect checks intersecting that tube.

  3. Add the full neighboring check-edge boundary halo needed to decide whether an accessible check touches an inaccessible one.

  4. Retain only geometry required by the fixed local rule.

The halo is essential. Using only checks wholly inside the tube can erase the measurement boundary and admit an invalid correction. Geometry budgets count local cells, incidences and estimated Python-object storage. Current ceilings are 262,144 cells, 4,000,000 incidences and min(512 MiB, one quarter of live available RAM). Larger workflow budgets do not bypass those caps.

Syndrome components and filling

Accessible checks yield a binary defect one-chain in the actual measurement model. Components are traversed in deterministic cell order. The decoder checks measurement-boundary contact and zero mod-two boundary, constructs a consistent lift to integer coordinates, and bounds the lift’s box side. A noncontractible periodic component cannot be assigned an inconsistent finite lift silently. Every edge of the filling box must be accessible and the correction support must stay inside the tube.

fill_closed_edge_chain contracts an admitted closed chain by an ordered coordinate sweep. For each coordinate, it pushes occupied transverse edges from upper to lower box levels using plaquette boundaries. The plaquettes are accumulated modulo two. It verifies the final residual is empty, the fill’s boundary equals the original component and the fill remains in the box. The production local adapter keeps a 512-box-edge reference cap.

Rejected components contribute identity correction, not a missing measurement or a discarded configuration. Accepted fills combine by XOR. The intersection with the logical representative supplies the correction sign. This rule is deterministic; it does not optimize a posterior probability or minimum energy.

Compiled decoder geometry is cached under a key of lengths, measurement degree, support and cutoffs. The bounded cache evicts by insertion order; it is not refreshed into a true access-order LRU. The cache contains read-only geometry, not sampled states or measurement results.

Vertex measurements

vertex.measure computes a point-product parity with integer translations or fixed bit extraction. Translational averaging counts the odd parity bits and returns 1-2*count/(LM). Magnetization uses the bit population count, m=1-2*popcount/(LM), then applies the requested absolute/power modifier. No collapsed global-sign average is applied. See The vertex code and its two-dimensional image for the distinction between translated joint products and products of spatial or spacetime averages.

General summary assembly

api._assemble_result reads chain JSONL measurements within the bounded workflow and pools each completed segment. Simple means use all retained records. Connected f uses pooled d-a*b and exposes its signed and absolute values. Histories remain separated by chain for diagnostics.

The connected influence used for diagnostics is \(I=d-m_Ba-m_Ab\); an additive constant is irrelevant for its variance and autocorrelation. The implementation does not derive d by multiplying recorded a and b. If chain lengths differ, a diagnostic is unresolved rather than silently truncating/padding the chains to hide the discrepancy.

For a batch size b and m equal-length chains with n records each, the MCSE uses K=floor(n/b) complete blocks within each chain. Its variance estimate is

\[\widehat{\operatorname{Var}}(\widehat\mu_{\rm truncated}) =\frac1{m^2}\sum_{j=1}^m\frac{s_j^2}{K},\]

where s_j^2 is the sample variance of chain j’s K batch means. Each chain needs at least two batches and positive batch variance. Record the discarded tail length explicitly. The statistic is for the truncated pooled mean, whereas the ordinary summary uses all retained records. No calibrated nonlinear functional interval or scientific convergence policy is attached automatically.

Rank Rhat

For once-split chains of length n, compute the within-chain variance W, between-chain variance B and

\[\widehat V=\frac{n-1}{n}W+\frac Bn,\qquad \widehat R=\sqrt{\widehat V/W}.\]

Before this calculation the method pools ranks, averages ties and transforms rank r using Phi^-1((r-3/8)/(N+1/4)). It repeats the calculation for absolute deviations from the pooled original median, then takes the maximum of the rank and folded components. Degenerate rank/folded variation returns an unresolved None value. The variance fields describe the transformed scale.

Bulk and tail ESS

Bulk ESS rank-normalizes once-split chains. The multichain helper centers each split chain, pads an FFT to avoid circular wraparound and computes biased linear autocovariances with denominator n. Between-chain variation enters the combined variance; it cannot be replaced by averaging independent single-chain ESS values.

The initial positive paired autocorrelation sequence is made monotone. The implementation retains its specified antithetic endpoint and applies tau>=1/log10(N) before returning ESS=N/tau. ESS can exceed N for negative autocorrelation. The cap and endpoint affect short or antithetic fixtures and must not be simplified away during refactoring. Constant/insufficient split histories remain explicitly unresolved.

Tail ESS uses two pooled-quantile indicators, x<=q_p and x<=q_(1-p), splits each once and returns their minimum only when both helpers are estimated. Discrete ties can make one indicator constant. The API then returns None, not a spuriously perfect tail ESS. References and the intended statistical definitions are listed in References.