Skip to content

Commit

Permalink
more qiskit 1.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Apr 26, 2024
1 parent 726d195 commit de2dab7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
connexion>=2.12.0
qiskit==0.45.3
qiskit
thrift>=0.15.0
matplotlib>=3.5.1
waitress>=2.1.1
Expand Down
12 changes: 11 additions & 1 deletion src/qrisp/circuit/quantum_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,17 @@ def qasm(self, formatted=False, filename=None, encoding=None):
The OPENQASM string.
"""
return self.to_qiskit().qasm(formatted, filename, encoding)
qiskit_qc = self.to_qiskit()
if hasattr(qiskit_qc, "qasm"):
qasm_str = qiskit_qc.qasm(formatted, filename, encoding)
else:
from qiskit.qasm2 import dump, dumps
if filename:
qasm_str = dump(qiskit_qc, filename)
else:
qasm_str = dumps(qiskit_qc)

return qasm_str

def depth(self, depth_indicator = lambda x : 1, transpile=True):
"""
Expand Down

0 comments on commit de2dab7

Please sign in to comment.