From 4b6631d5852aad54633291fe9dca9dafb0050479 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 11:04:18 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20pre-commit=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mqt/bench/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mqt/bench/utils.py b/src/mqt/bench/utils.py index 0c0ea5c42..c68b88a80 100644 --- a/src/mqt/bench/utils.py +++ b/src/mqt/bench/utils.py @@ -47,7 +47,8 @@ class SupermarqFeatures: directed_program_communication: float single_qubit_gates_per_layer: float multi_qubit_gates_per_layer: float - gate_coverage: NDArray[np.float_] + gate_coverage: NDArray[np.float64] + qasm_path = str(resources.files("mqt.benchviewer") / "static/files/qasm_output/") @@ -296,7 +297,7 @@ def calc_supermarq_features( for op in dag.two_qubit_ops(): q1, q2 = op.qargs di_graph.add_edge(qc.find_bit(q1).index, qc.find_bit(q2).index) - degree_sum = sum([di_graph.degree(n) for n in di_graph.nodes]) + degree_sum = sum(di_graph.degree(n) for n in di_graph.nodes) directed_program_communication = degree_sum / (2 * num_qubits * (num_qubits - 1)) if num_qubits > 1 else 0 # average number of 1q gates per layer = num of 1-qubit gates in the circuit / depth @@ -313,7 +314,7 @@ def calc_supermarq_features( all_ops = dag.count_ops() for dev in devices.get_available_devices(): n_circ_gates = sum(list(all_ops.values())) - n_circ_gates_on_dev = sum([count for gate, count in all_ops.items() if gate in dev.basis_gates]) + n_circ_gates_on_dev = sum(count for gate, count in all_ops.items() if gate in dev.basis_gates) coverage.append(n_circ_gates_on_dev / n_circ_gates) gate_coverage = np.array(coverage)