mqt.core.bench.qft

QFT benchmark instances and options.

Module Contents

class Method

Bases: enum.Enum

Full-register or semiclassical measurement-and-feed-forward method.

STANDARD = 0
SEMICLASSICAL = 1
class Options(*, qubits: int, period_exponent: int, method: Method = Method.STANDARD)

Parameters for a QFT benchmark.

property qubits: int

The transform width and number of output bits, independent of qubit reuse.

property period_exponent: int

The exponent \(k\) of the input period \(2^k\).

property method: Method

The circuit method.

class QFT(options: Options)

A validated QFT benchmark.

The semiclassical method uses measurements and classical feedback in place of controlled gates before readout. For this benchmark’s input states, it also prepares each input bit as needed and reuses one measured and reset qubit. The standard method uses a full register. Both methods return the same number of bits; qubit reuse is an implementation choice in addition to the semiclassical transform.

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>') → QFT

Parse a strict benchmark instance specification.

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

Parse a strict benchmark manifest.