@@ -707,29 +707,34 @@ nice_calibrated_dem = demutil.regeneralize_spatial_dem(
707707#### GARI transformed matrices
708708
709709` demutil.gari.circuit_to_gari ` converts a supported correlated CSS Stim
710- circuit into a GARI matrix DEM and companion layout for Tesseract. It
711- generates a flattened source DEM with ` decompose_errors=False ` . Detectors must
712- follow the repository's fourth-coordinate convention: values ` 0 ` –` 2 ` identify
713- X detectors and ` 3 ` – ` 5 ` identify Z detectors.
710+ circuit into a GARI matrix DEM. It generates a flattened source DEM with
711+ ` decompose_errors=False ` . Detectors must follow the repository's
712+ fourth-coordinate convention: values ` 0 ` –` 2 ` identify X detectors and ` 3 ` – ` 5 `
713+ identify Z detectors.
714714
715715``` python
716716import stim
717717from tesseract_decoder import demutil
718718
719719circuit = stim.Circuit.from_file(" circuitFile.stim" )
720- gari_dem, gari_layout = demutil.gari.circuit_to_gari(
720+ gari_dem = demutil.gari.circuit_to_gari(
721721 circuit,
722722 prior_function = demutil.gari.tesseract_xor_prior_probabilities,
723723)
724724```
725725
726- ` circuit_to_gari ` returns:
726+ The returned DEM preserves the source detector IDs as a prefix and appends the
727+ virtual detector rows. For matrix analysis,
728+ ` circuit_to_gari(..., row_order="block") ` instead emits the internal
729+ ` [physical X, physical Z, virtual Z, virtual X] ` row order. This research form
730+ does not accept source syndromes as a direct prefix.
727731
728- * ` gari_dem ` : the augmented detector and logical matrices stored using Stim
729- DEM syntax.
730- * ` gari_layout ` : a ` tesseract.gari_layout.v1 ` dictionary containing the source
731- and GARI detector counts, the ` source_to_gari ` detector mapping, and the
732- ` physical_then_virtual ` detector order.
732+ ` demutil.gari.build_detector_orders(circuit, gari_dem, num_det_orders, ...) `
733+ uses the source circuit to build BFS, coordinate, or index orders and then
734+ appends the virtual detector IDs. The resulting list has the same format as
735+ ` TesseractConfig.det_orders ` and the Tesseract CLI's ` --detector-orders ` JSON
736+ file. It applies to the default source-aligned GARI DEM, not the research-only
737+ block form.
733738
734739Related public APIs:
735740
@@ -738,13 +743,14 @@ Related public APIs:
738743* ` demutil.gari.GariTransform ` is passed to prior-policy callbacks. It exposes
739744 the transformed detector and logical matrices, the ` U ` and ` V ` projection
740745 matrices, the source ` e_Z ` , ` e_X ` , and ` e_Y ` column indices, and the source
741- detector mapping.
746+ detector mapping into the internal block rows .
742747* ` paper_prior_probabilities ` , ` tesseract_xor_prior_probabilities ` , and
743748 ` tesseract_lp_max_barred_cost_prior_probabilities ` return one probability for
744749 each transformed GARI column. A user-defined prior can follow the same
745750 callable interface.
746751
747752The returned GARI matrix DEM stores transformed matrices for decoding and must
748- not be sampled. Sample from the original circuit and use the companion layout
749- to place its physical syndrome. See the
753+ not be sampled. Sample from the original circuit, copy its syndrome into the
754+ beginning of a zero-filled GARI syndrome, and leave the virtual suffix zero.
755+ See the
750756[ GARI tutorial] ( ../../docs/tutorial.ipynb ) for a complete decoding example.
0 commit comments