Skip to main content

simulate_program

Function simulate_program 

Source
pub fn simulate_program(
    program: &DynamicProgram,
) -> SimulateProgram<'_, Unseeded>
Expand description

Start a run of program on BackendKind::Auto.

A program with no runtime control flow runs as its one circuit does, through simulate, so it keeps every sampling shortcut and the same seeded shots. Any other program has each block fused for the backend once. On the host statevector the shots then walk the graph together, splitting binomially at each measurement as circuits with mid-circuit measurements do, so the program evolves once per distinct outcome history. On any other backend every shot walks the graph on a fresh state, seeded as the per-shot circuit routes seed shot i.

Auto routing reads every block at once, so a program holding only Clifford gates runs on the stabilizer tableau, and a runtime rotation counts as a non-Clifford gate. Stabilizer rank, Pauli propagation, and the distributed statevector have no per-shot state to walk a graph on and decline.