Skip to content

🎨 Miscellaneous Fixes #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 15, 2025
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"numpy>=1.26; python_version >= '3.12'",
"numpy>=1.24; python_version >= '3.11'",
"numpy>=1.22",
"scikit-learn>=1.5.2",
]


Expand Down
2 changes: 0 additions & 2 deletions src/mqt/bench/benchmarks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
pricingcall,
pricingput,
)
from mqt.bench.benchmarks.qiskit_application_ml import qnn
from mqt.bench.benchmarks.qiskit_application_nature import groundstate
from mqt.bench.benchmarks.qiskit_application_optimization import routing, tsp

Expand All @@ -22,7 +21,6 @@
"portfoliovqe",
"pricingcall",
"pricingput",
"qnn",
"routing",
"tsp",
]
4 changes: 2 additions & 2 deletions src/mqt/bench/tket_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pytket.qasm import circuit_to_qasm_str
from qiskit import QuantumCircuit, transpile

from .utils import convert_cmap_to_tuple_list, get_openqasm_gates, save_as_qasm
from .utils import get_openqasm_gates, save_as_qasm

if TYPE_CHECKING: # pragma: no cover
from pytket._tket.passes import BasePass
Expand Down Expand Up @@ -284,7 +284,7 @@ def get_mapped_level(
return False

cmap = device.coupling_map
cmap_converted = convert_cmap_to_tuple_list(cmap)
cmap_converted = [(c[0], c[1]) for c in cmap]
arch = Architecture(cmap_converted)

# add blank wires to the circuit such that afterwards the number of qubits is equal to the number of qubits of the architecture
Expand Down
7 changes: 0 additions & 7 deletions src/mqt/bench/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,10 @@ def get_module_for_benchmark(benchmark_name: str) -> ModuleType:
"""Returns the module for a specific benchmark."""
if benchmark_name in ["portfolioqaoa", "portfoliovqe", "pricingcall", "pricingput"]:
return import_module("mqt.bench.benchmarks.qiskit_application_finance." + benchmark_name)
if benchmark_name == "qnn":
return import_module("mqt.bench.benchmarks.qiskit_application_ml.qnn")
if benchmark_name == "groundstate":
return import_module("mqt.bench.benchmarks.qiskit_application_nature.groundstate")
if benchmark_name == "routing":
return import_module("mqt.bench.benchmarks.qiskit_application_optimization.routing")
if benchmark_name == "tsp":
return import_module("mqt.bench.benchmarks.qiskit_application_optimization.tsp")
return import_module("mqt.bench.benchmarks." + benchmark_name)


def convert_cmap_to_tuple_list(c_map: list[list[int]]) -> list[tuple[int, int]]:
"""Converts a coupling map to a list of tuples."""
return [(c[0], c[1]) for c in c_map]
16 changes: 0 additions & 16 deletions tests/test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,22 +314,6 @@ def test_routing() -> None:
assert qc.depth() > 0


def test_unidirectional_coupling_map() -> None:
"""Test the unidirectional coupling map for the OQC Lucy device."""
qc = get_benchmark(
benchmark_name="dj",
level="mapped",
circuit_size=3,
compiler="tket",
compiler_settings=CompilerSettings(tket=TKETSettings(placement="graphplacement")),
provider_name="oqc",
device_name="oqc_lucy",
)
# check that all gates in the circuit are in the coupling map
cmap = utils.convert_cmap_to_tuple_list(OQCProvider.get_device("oqc_lucy").coupling_map)
assert qc.valid_connectivity(arch=pytket.architecture.Architecture(cmap), directed=True)


@pytest.mark.parametrize(
(
"benchmark_name",
Expand Down
360 changes: 130 additions & 230 deletions uv.lock

Large diffs are not rendered by default.

Loading