mqt.core.bench.magic_state_distillation

Magic-state distillation benchmark instances and options.

Module Contents

class Options(*, levels: int = 1)

Parameters for concatenated 15-to-1 magic-state distillation.

property levels: int

Positive number of concatenated levels.

The qubit count (five per level) must fit signed 64-bit circuit dimensions.

class MagicStateDistillation(options: Options = ...)

A concatenated 15-to-1 magic-state distillation benchmark.

Each block uses Litinski’s five-qubit 15-to-1 circuit. The first level uses ideal \(\pi/8\) Pauli rotations; later levels implement these rotations with the preceding level’s retained \(T^\dagger|+\rangle\) states. The circuit uses 5 * levels qubits and executes 15**levels leaf rotations per shot. Backend and resource limits apply.

Bit 1 flags any rejected block; bit 0 checks the retained root state against \(T^\dagger|+\rangle\). Ideal output is 00. All blocks execute once, regardless of rejection. The benchmark models ideal logical circuits without input noise, physical error correction, or retries.

property options: Options

The resolved benchmark parameters.

property output: Output

The logical output register.

probability(outcome: str) → float

Return the ideal probability of an outcome.

evaluate(counts: Mapping[str, int]) → Evaluation

Compare sampled counts with the ideal distribution.

generate() → QCProgram

Generate the benchmark as a QC program.

property instance_specification_json: str

The canonical instance specification JSON.

property manifest_json: str

The canonical manifest JSON.

property case_id: str

The stable semantic case ID.

static from_instance_specification_json(json: str, *, source: str = '<instance-specification>') → MagicStateDistillation

Parse a strict benchmark instance specification.

static from_manifest_json(json: str, *, source: str = '<manifest>') → MagicStateDistillation

Parse a strict benchmark manifest.