mqt.core.bench.grover_weak_measurement

Weak-measurement Grover benchmark instances and options.

Module Contents

class Options(*, marked_bitstring: str, measurement_strength: float | None = None)

Parameters for a weak-measurement Grover benchmark.

property marked_bitstring: str

The big-endian marked outcome with 2 through 2044 bits.

property measurement_strength: float | None

The finite strength \(0<\kappa\leq 2^{-n/2}\), or None for the upper bound.

class Grover(options: Options)

A validated weak-measurement Grover benchmark.

The benchmark prepares a uniform state and applies one Grover iteration before each \(\kappa\)-measurement. The measurement computes the predicate with \(O_\chi\), applies the controlled \(R_\kappa\) rotation, uncomputes \(O_\chi\), and measures the probe. An outcome of \(0\) continues the loop; \(1\) exits with the marked state.

By default, the measurement strength is \(\kappa=2^{-n/2}\) for \(n\) search qubits. The accepted range \(0<\kappa\leq 2^{-n/2}\) follows the paper’s robustness bound.

property options: Options

The resolved benchmark parameters.

property output: Output

The logical output register.

property qubits: int

The number of search qubits.

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

Parse a strict benchmark instance specification.

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

Parse a strict benchmark manifest.