pipeline
Compilation pipeline from prepared graphs to executable programs.
compile_program
compile_program(
prepared: SamplingGraph,
*,
mode: DecompositionMode,
strategy: DecompositionStrategy = "cat5"
) -> CompiledProgram
Compile a prepared graph into an executable sampling program.
This function performs the second phase of compilation: 1. Split the graph into connected components 2. For each component: - Plug outputs according to mode (sequential or joint) - Reduce each plugged graph - Perform stabilizer rank decomposition - Compile into CompiledScalarGraphs objects 3. Assemble into CompiledProgram with output ordering
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prepared | SamplingGraph | The prepared graph from prepare_graph(). | required |
mode | DecompositionMode | Decomposition mode: - "sequential": For sampling - creates [0, 1, 2, ..., n] circuits - "joint": For probability estimation - creates [0, n] circuits | required |
strategy | DecompositionStrategy | Stabilizer rank decomposition strategy. Must be one of "cat5", "bss", "cutting". | 'cat5' |
Returns:
| Type | Description |
|---|---|
CompiledProgram | A CompiledProgram ready for sampling. |
Source code in src/tsim/compile/pipeline.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |