From c11441f51674d85fa5197a21212a1106a748adef Mon Sep 17 00:00:00 2001 From: "Davide Gessa (dakk)" Date: Mon, 30 Oct 2023 08:10:08 +0100 Subject: [PATCH] use qiskit-aer in github testing env --- test/utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/utils.py b/test/utils.py index 4e7abe8b..2a64df04 100644 --- a/test/utils.py +++ b/test/utils.py @@ -16,9 +16,7 @@ import random from typing import Tuple, get_args -from pyqrack import qrack_simulator from qiskit import QuantumCircuit, transpile -from qiskit.providers.qrack import Qrack from qiskit_aer import Aer from sympy.logic.boolalg import gateinputcount @@ -26,6 +24,14 @@ COMPILATION_ENABLED = True +try: + from pyqrack import qrack_simulator + from qiskit.providers.qrack import Qrack + + qsk_simulator = Qrack.get_backend("qasm_simulator") +except: + qsk_simulator = Aer.get_backend("aer_simulator") + def test_not(a: bool) -> bool: return not a @@ -39,14 +45,10 @@ def test_qint3(a: Qint3) -> bool: return not a[0] -aer_simulator = Aer.get_backend("aer_simulator") -# aer_simulator = Qrack.get_backend("qasm_simulator") - - def qiskit_measure_and_count(circ, shots=1): circ.measure_all() - circ = transpile(circ, aer_simulator) - result = aer_simulator.run(circ, shots=shots).result() + circ = transpile(circ, qsk_simulator) + result = qsk_simulator.run(circ, shots=shots).result() counts = result.get_counts(circ) return counts