RoundBasedFactory Class

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 sum function models the case in which qubits are not reused across rounds, while the max function models the case in which qubits are reused across rounds.

For the enumeration of logical-level distillation units, the factory relies on a user-provided ISAQuery (defaulting to SurfaceCode.q()) to explore different surface code configurations and their corresponding lattice surgery instructions. These need to be provided by the user and cannot automatically be derived from the provided implementation ISA, as they can only contain a subset of the required instructions. The user needs to ensure that the provided query matches the architecture for which this factory is being used.

Results are cached to disk for efficiency.

References:

  • Sergei Bravyi, Alexei Kitaev: Universal Quantum Computation with ideal Clifford gates and noisy ancillas, arXiv:quant-ph/0403025

  • Michael E. Beverland, Prakash Murali, Matthias Troyer, Krysta M. Svore, Torsten Hoefler, Vadym Kliuchnikov, Guang Hao Low, Mathias Soeken, Aarthi Sundaram, Alexander Vaschillo: Assessing requirements to scale to practical quantum advantage, arXiv:2211.07629

Constructor

RoundBasedFactory(code_query: ~qdk.qre._isa_enumeration.ISAQuery = <factory>, physical_qubit_calculation: ~typing.Callable[[~typing.Iterable], int] = <built-in function sum>, cache_dir: ~pathlib.Path = WindowsPath('C:/Users/cloudtest/.cache/re3/round_based'), use_cache: bool = True)

Parameters

Name Description
code_query
Default value: <factory>
physical_qubit_calculation
Default value: <built-in function sum>
cache_dir
Default value: C:\Users\cloudtest\.cache\re3\round_based
use_cache
Default value: True

Methods

provided_isa
required_isa

provided_isa

provided_isa(impl_isa: ISA, ctx: ISAContext) -> Generator[ISA, None, None]

Parameters

Name Description
impl_isa
Required
ctx
Required

required_isa

static required_isa() -> ISARequirements

Attributes

physical_qubit_calculation

Callable[[Iterable], int] Function to calculate total physical qubits from per-round space requirements, e.g., sum or max. Defaults to sum.

Positional-Only Parameters

Name Description
iterable

Parameters

Name Description
start
Default value: 0

code_query

ISAQuery Query to enumerate QEC codes for logical distillation units. Defaults to SurfaceCode.q().

code_query: ISAQuery

cache_dir

Path Directory for caching computed factory configurations. Defaults to ~/.cache/re3/round_based.

cache_dir: Path = WindowsPath('C:/Users/cloudtest/.cache/re3/round_based')

use_cache

bool Whether to use cached results. Defaults to True.

use_cache: bool = True