mqt.core.bench.qpe

QPE benchmark instances and options.

Module Contents

class Phase(*, numerator: int, denominator: int)

An exact phase \(\phi=p/q\) in turns, reduced modulo one turn.

property numerator: int

The reduced numerator \(p\).

property denominator: int

The reduced denominator \(q\).

class Method

Bases: enum.Enum

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

STANDARD = 0
ITERATIVE = 1
class Options(*, precision: int, phase: Fraction | Phase, method: Method = ...)

Parameters for a QPE benchmark.

property precision: int

The number of measured phase bits.

property phase: Fraction

The reduced phase in turns.

property method: Method

The circuit method.

class QPE(options: Options)

A validated QPE benchmark.

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

Parse a strict benchmark instance specification.

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

Parse a strict benchmark manifest.