factories Package
Classes
| GSJ24CCXFactory |
Implements the 8|T⟩ → >>|<<CCX⟩ magic state factory described in Fig. 24 of Gidney, Shutty, and Jones (2024). This design converts eight T magic states into a single CCX (Toffoli) state using lattice surgery operations on 12 logical qubits (including helper qubits) with a circuit depth of 6. The output CCX error rate has two contributions:
The factory production time includes an overhead factor of (1 + 8·p_T) to account for the failure probability when consuming the T states. Reference:
|
| GSJ24Factory |
Implements the magic state cultivation factory from Gidney, Shutty, and Jones (2024) for producing logical >>|<<T⟩ states from physical-level operations. Magic state cultivation gradually grows the size and reliability of a magic state within a surface code patch, using roughly the same number of physical gates as a lattice surgery CNOT gate of equivalent reliability. The approach refines ideas from Knill (1996), Jones (2016), Chamberland (2020), Gidney (2023/2024), Bombin (2024), and Hirano (2024). Compared to prior magic state distillation approaches, cultivation uses an order of magnitude fewer qubit-rounds to reach logical error rates as low as 2·10⁻⁹ under 10⁻³ uniform depolarizing circuit noise. Halving the circuit noise to 5·10⁻⁴ improves the achievable logical error rate to 4·10⁻¹¹. The factory is parameterized by pre-computed simulation data (from Monte Carlo sampling at https://doi.org/10.5281/zenodo.13777072) that maps physical error rates to (logical_error, num_qubits, volume, steps) tuples for supported distance pairs. Hyper parameters: distance: Tuple (d_color, d_surface) specifying the color code distance and surface code distance used in the cultivation protocol. Supported values are (3, 15) and (5, 15). Larger color code distance (5 vs 3) yields lower logical error rates at the cost of higher qubit count and more time steps. Reference:
|
| Litinski19Factory |
T and CCZ factories based on the paper arXiv:1905.06903. It contains two categories of estimates. If the input T error rate is similar to the Clifford error, it produces magic state instructions based on Table 1 in the paper. If the input T error rate is at most 10 times higher than the Clifford error rate, it produces magic state instructions based on Table 2 in the paper. It requires Clifford error rates of at most 0.1% for CNOT, H, and MEAS_Z instructions. If these instructions have different error rates, the maximum error rate is assumed. References:
|
| MagicUpToClifford |
An ISA transform that adds Clifford equivalent representations of magic
states. For example, if the input ISA contains a T gate, the provided ISA
will also contain Example: |
| RoundBasedFactory |
A magic state factory that produces T gate instructions using round-based distillation pipelines. This factory explores combinations of distillation units (such as "15-to-1 RM prep" and "15-to-1 space efficient") to find optimal configurations that minimize time and space while achieving target error rates. It supports both physical-level distillation (when the input T gate is physically encoded) and logical-level distillation (using lattice surgery via surface codes). In order to account for the success probability of distillation rounds, the factory models the pipeline using a failure probability requirement (defaulting to 1%) that each round must meet. The number of distillation units per round is adjusted to meet this requirement, which in turn affects the overall space requirements. Space requirements are calculated using a user-provided function that
aggregates per-round space (e.g., sum or max). The For the enumeration of logical-level distillation units, the factory relies
on a user-provided Results are cached to disk for efficiency. References:
|