Skip to content

CompiledProgram

Bases: Displayable

What an engine runs for a program: plain, serializable data.

It is filled here by tracing one shot of the program, and later could be filled ahead of time by a static compiler. It holds no History index, closure or live object, and is keyed by the measurement record, which is the concatenation of the steps' outcome bits.

Each entry of steps is a dict with five keys:

  • name and type: those of the instruction that ran.
  • outcome_labels: the qubit labels behind the record bits the step wrote, in record order; an entry is None for a bit with no qubit label (an MPP bit).
  • emitted: a dict from a target name to what the step emitted for that target, so one step can carry several targets. The "stim" target holds the STIM text the step ran, and a step that emits nothing has an empty dict.
  • reads: a sorted list of the indices of earlier steps whose output the step collects, which records feed-forward as data flow. It is an over-approximation: every earlier step that set a key the step collects counts, and an in-place change to shared data isn't seen.

A step may gain keys later, so read a step by key and never assume these five are all there is.

CompiledProgram

CompiledProgram(qubit_labels: list, steps: list) -> None

Attributes

Name Type Value Doc
qubit_labels list unset The program's qubit register.

A target's internal index i in emitted text means qubit_labels[i].
steps list unset One dict per executed instruction, in run order.

decode

Inherited static method from Serializable.decode().


display

Inherited method from Displayable.display().


dump

Inherited method from Serializable.dump().


encode

Inherited static method from Serializable.encode().


load

Inherited class method from Serializable.load().


read

Inherited class method from Serializable.read().


serialize_function

Inherited static method from Serializable.serialize_function().


write

Inherited method from Serializable.write().