CompiledGraph#
- class tqec.compile.CompiledGraph(layout_slices, observables)[source]#
Bases:
object
Represents a compiled block graph.
This class should be easy to scale and generate circuits directly.
- Parameters:
layout_slices (list[BlockLayout])
observables (list[AbstractObservable])
- layout_slices#
a list of
BlockLayout
instances that represent the compiled blocks at contiguous time slices.- Type:
list[tqec.compile.block.BlockLayout]
- observables#
a list of
AbstractObservable
instances that represent the observables to be included in the compiled circuit.- Type:
list[tqec.compile.observables.abstract_observable.AbstractObservable]
Methods
__init__
(layout_slices, observables)generate_stim_circuit
(k[, noise_model, ...])Generate the
stim.Circuit
from the compiled graph.Attributes
Timeslices of compiled blocks arranged as 2-dimensional slices.
Observables to be included in the final
stim.Circuit
instance.Detailed methods
- __init__(layout_slices, observables)#
- Parameters:
layout_slices (list[BlockLayout])
observables (list[AbstractObservable])
- Return type:
None
- generate_stim_circuit(k, noise_model=None, manhattan_radius=2, detector_database=None, only_use_database=False)[source]#
Generate the
stim.Circuit
from the compiled graph.- Parameters:
k (int) – scale factor of the templates.
noise_models – noise models to be applied to the circuit.
manhattan_radius (int) – radius considered to compute detectors. Detectors are not computed and added to the circuit if this argument is negative.
detector_database (DetectorDatabase | None) – an instance to retrieve from / store in detectors that are computed as part of the circuit generation.
only_use_database (bool) – if
True
, only detectors from the database will be used. An error will be raised if a situation that is not registered in the database is encountered.noise_model (NoiseModel | None)
- Returns:
A compiled stim circuit.
- Return type:
Circuit