Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tsim.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This module defines immutable data structures that represent the different stages of circuit compilation:
  1. SamplingGraph: Result of parsing and reducing a circuit graph
  2. CompiledComponent: A single compiled connected component
  3. CompiledProgram: The full compiled circuit ready for sampling

class CompiledComponent

CompiledComponent()
A single compiled connected component of a circuit. Each component is independent and can be sampled separately. The results are then combined according to output_indices.

class CompiledProgram

CompiledProgram(components: tuple[CompiledComponent, ...], direct_f_indices: Array, direct_flips: Array, output_order: Array, output_reindex: Array | None, num_outputs: int, num_detectors: int)
A fully compiled circuit program ready for sampling. This is the result of compiling a SamplingGraph and contains everything needed to sample from the circuit.

class CompiledScalarGraphs

CompiledScalarGraphs()
JAX-compatible compiled representation of a list of scalar ZX graphs. The scalar for each graph is a product of four term families, multiplied by a per-graph ScalarPrefactor (global phase, floatfactor, 2^power2, optional approximate complex floatfactor). All arrays are static-shaped so the whole struct can be traced under jax.jit.

class SamplingGraph

SamplingGraph(graph: BaseGraph, error_transform: np.ndarray, channel_probs: list[np.ndarray], num_outputs: int, num_detectors: int)
Result of the graph preparation phase for sampling. Contains all data structures needed for sampling. This represents a circuit that has been:
  1. Parsed from stim format
  2. Converted to a ZX graph
  3. Doubled (composed with adjoint)
  4. Reduced via zx.full_reduce
  5. Had its error basis transformed (Gaussian elimination: e → f)