Skip to main content

emit_plan_stim

Function emit_plan_stim 

Source
pub fn emit_plan_stim(
    plan: &NodeEmissionPlan,
    options: &PlanStimOptions<'_>,
) -> Result<PlanStim, StimEmissionError>
Expand description

Lower one node’s emission plan to standalone Stim text.

Every Op variant is handled, so a plan is never rejected for containing an operation this does not know about. Two conventions are worth naming because they are not the only defensible choices:

  • REPEAT is unrolled. Self::measurement_columns are absolute positions, and a measurement inside a loop occupies a different one every iteration. Unrolling is what makes the map well defined; the cost is that a plan with a large repetition count produces proportionally large text.
  • A feedback Y is written as CX then CZ, not CY. The control is a classical record, so the phase difference between Y and XZ is constant across the whole branch and cannot be observed. This matches the convention the artifacts already in the field were built with, and deliberately differs from emit_bloq_stim, whose text is pinned by its own consumers.

§Errors

§Panics

In debug builds, panics if plan emission disagrees with the circuit column walk.