Skip to content

Commit

Permalink
🔥 removed ECR gate postprocessing that is not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
nquetschlich committed Apr 19, 2024
1 parent 244c6c0 commit 8dca514
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions src/mqt/bench/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
from qiskit.converters import circuit_to_dag
from qiskit_optimization.applications import Maxcut

from mqt.bench.devices import OQCProvider

if TYPE_CHECKING or sys.version_info >= (3, 10, 0): # pragma: no cover
from importlib import metadata, resources
else:
Expand Down Expand Up @@ -210,22 +208,9 @@ def save_as_qasm(
f.write(qc_str)
f.close()

if gate_set == OQCProvider.get_native_gates():
postprocess_single_oqc_file(str(file))
return True


def postprocess_single_oqc_file(filename: str) -> None:
with Path(filename).open() as f:
lines = f.readlines()
with Path(filename).open("w") as f:
for line in lines:
if not ("gate rzx" in line.strip("\n") or "gate ecr" in line.strip("\n")):
f.write(line)
if 'include "qelib1.inc"' in line.strip("\n"):
f.write("opaque ecr q0,q1;\n")


def create_zip_file(zip_path: str | None = None, qasm_path: str | None = None) -> int:
if zip_path is None:
zip_path = get_zip_file_path()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ def test_saving_qasm_to_alternative_location_with_alternative_filename(
path.unlink()


def test_oqc_postprocessing() -> None:
def test_oqc_benchmarks() -> None:
qc = get_benchmark("ghz", 1, 5)
directory = "."
filename = "ghz_oqc"
Expand Down

0 comments on commit 8dca514

Please sign in to comment.