PipelineResult

class PipelineResult[source]

Bases: dict

Pipeline result dict with convenience access for single-result pipelines.

Behaves exactly like a regular dict keyed by NodeKey tuples. For the common single-circuit case, use the value property instead of result[()].

Attributes Summary

value

Return the single result value, unwrapped at the boundary.

Attributes Documentation

value

Return the single result value, unwrapped at the boundary.

Pipelines store expectation values in a canonical list[float] shape indexed by observable position. This accessor squeezes a length-1 list (single-observable expval) to a scalar float so casual callers get the natural shape — mirroring the scalar-in/scalar-out symmetry of higher-level programs like TimeEvolution. Probability and count dicts pass through unchanged; multi-observable lists are returned as-is. For the canonical raw form regardless of length, use result[()].

When the source MetaCircuit was constructed with _was_multi_obs=True (e.g. the user wrote observable=[O]), the pipeline disables the squeeze and a length-1 list is returned as-is.

Raises:

ValueError – If the result contains more than one key.