tqec.compile.compile.compile_block_graph

compile_block_graph(block_graph: BlockGraph, observables: list[AbstractObservable] | Literal['auto'] | None = 'auto', custom_spec_rules: dict[CubeSpec, SpecRule] | None = None, custom_substitute_rules: dict[SubstitutionKey, SubstitutionRule] | None = None) CompiledGraph[source]

Compile a block graph.

Parameters:
  • block_graph – The block graph to compile.

  • observables – The abstract observables to be included in the compiled circuit. If set to “auto”, the observables will be automatically determined from the block graph. If a list of abstract observables is provided, only those observables will be included in the compiled circuit. If set to None, no observables will be included in the compiled circuit.

  • custom_spec_rules – Custom specification rules for the cube specs. This is a dict mapping the cube specs to the corresponding spec rules. If not provided, the default spec rules will be used. Spec rules determine how to compile a cube spec into a compiled block, i.e which template to use and the specific plaquettes to use in the template.

  • custom_substitute_rules – Custom substitution rules for the compiled blocks. This is a dict mapping the substitution keys to the corresponding substitution rules. If not provided, the default substitution rules will be used. Substitution rules determine how to substitute plaquettes in the two compiled blocks connected by a pipe.

Returns:

A CompiledGraph object that can be used to generate a cirq/stim circuit and scale easily.