mqt.bench

MQT Bench.

Submodules

Package Contents

class BenchmarkLevel[source]

Bases: enum.Enum

Enum representing different levels.

ALG
INDEP
NATIVEGATES
MAPPED
get_benchmark(benchmark: str, level: BenchmarkLevel, circuit_size: int, target: Target | None = None, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit[source]
get_benchmark(benchmark: QuantumCircuit, level: BenchmarkLevel, circuit_size: None, target: Target | None = None, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit
get_benchmark(benchmark: str | QuantumCircuit, level: BenchmarkLevel, circuit_size: int | None = None, target: Target | None = None, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit

Returns one benchmark as a qiskit.QuantumCircuit object.

Parameters:
  • benchmark – QuantumCircuit or name of the benchmark to be generated

  • level – Choice of level

  • circuit_size – Input for the benchmark creation, in most cases this is equal to the qubit number

  • target~qiskit.transpiler.target.Target for the benchmark generation (only used for “nativegates” and “mapped” level)

  • opt_level – Optimization level to be used by the transpiler.

  • generate_mirror_circuit – If True, generates the mirror version (U @ U.inverse()) of the benchmark.

  • random_parameters – If True, assigns random parameters to the circuit’s parameters if they exist.

  • kwargs – Additional keyword arguments passed to the circuit creation.

Returns:

Qiskit::QuantumCircuit object representing the benchmark with the selected options

get_benchmark_alg(benchmark: str, circuit_size: int, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit[source]
get_benchmark_alg(benchmark: QuantumCircuit, circuit_size: None = None, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit
get_benchmark_alg(benchmark: str | QuantumCircuit, circuit_size: int | None = None, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit

Return an algorithm-level benchmark circuit.

Parameters:
  • benchmark – QuantumCircuit or name of the benchmark to be generated

  • circuit_size – Input for the benchmark creation, in most cases this is equal to the qubit number

  • generate_mirror_circuit – If True, generates the mirror version (U @ U.inverse()) of the benchmark.

  • random_parameters – If True, assigns random parameters to the circuit’s parameters if they exist.

  • kwargs – Additional keyword arguments passed to the circuit creation.

Returns:

Qiskit::QuantumCircuit representing the raw benchmark circuit without any hardware-specific compilation or mapping.

get_benchmark_indep(benchmark: str, circuit_size: int, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit[source]
get_benchmark_indep(benchmark: QuantumCircuit, circuit_size: None = None, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit
get_benchmark_indep(benchmark: str | QuantumCircuit, circuit_size: int | None = None, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit

Return a target-independent benchmark circuit.

Parameters:
  • benchmark – QuantumCircuit or name of the benchmark to be generated

  • circuit_size – Input for the benchmark creation, in most cases this is equal to the qubit number

  • opt_level – Optimization level to be used by the transpiler.

  • generate_mirror_circuit – If True, generates the mirror version (U @ U.inverse()) of the benchmark.

  • random_parameters – If True, assigns random parameters to the circuit’s parameters if they exist.

  • kwargs – Additional keyword arguments passed to the circuit creation.

Returns:

Qiskit::QuantumCircuit expressed in a generic basis gate set, still unmapped to any physical device.

get_benchmark_mapped(benchmark: str, circuit_size: int, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit[source]
get_benchmark_mapped(benchmark: QuantumCircuit, circuit_size: None, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit
get_benchmark_mapped(benchmark: str | QuantumCircuit, circuit_size: int | None, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit

Return a benchmark fully compiled and qubit-mapped to a device.

Parameters:
  • benchmark – QuantumCircuit or name of the benchmark to be generated

  • circuit_size – Input for the benchmark creation, in most cases this is equal to the qubit number

  • target~qiskit.transpiler.target.Target for the benchmark generation

  • opt_level – Optimization level to be used by the transpiler.

  • generate_mirror_circuit – If True, generates the mirror version (U @ U.inverse()) of the benchmark.

  • random_parameters – If True, assigns random parameters to the circuit’s parameters if they exist.

  • kwargs – Additional keyword arguments passed to the circuit creation.

Returns:

Qiskit::QuantumCircuit that has been decomposed and routed onto the connectivity described by target.

get_benchmark_native_gates(benchmark: str, circuit_size: int, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit[source]
get_benchmark_native_gates(benchmark: QuantumCircuit, circuit_size: None, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit
get_benchmark_native_gates(benchmark: str | QuantumCircuit, circuit_size: int | None, target: Target, opt_level: int = 2, *, generate_mirror_circuit: bool = False, random_parameters: bool = True, **kwargs: Unpack[ConfigurationOptions]) QuantumCircuit

Return a benchmark compiled to the target’s native gate set.

Parameters:
  • benchmark – QuantumCircuit or name of the benchmark to be generated

  • circuit_size – Input for the benchmark creation, in most cases this is equal to the qubit number

  • target~qiskit.transpiler.target.Target for the benchmark generation

  • opt_level – Optimization level to be used by the transpiler.

  • generate_mirror_circuit – If True, generates the mirror version (U @ U.inverse()) of the benchmark.

  • random_parameters – If True, assigns random parameters to the circuit’s parameters if they exist.

  • kwargs – Additional keyword arguments passed to the circuit creation.

Returns:

Qiskit::QuantumCircuit whose operations are restricted to target’s native gate set but are not yet qubit-mapped to a concrete device connectivity.