Skip to content
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

Patch 1.1.2 #243

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bqskit/ext/qiskit/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
if TYPE_CHECKING:
from qiskit import QuantumCircuit

from qiskit import qasm2
from bqskit.ir.circuit import Circuit
from bqskit.ir.lang.qasm2 import OPENQASM2Language


def qiskit_to_bqskit(qc: QuantumCircuit) -> Circuit:
"""Convert Qiskit's QuantumCircuit `qc` to a BQSKit Circuit."""
circuit = OPENQASM2Language().decode(qc.qasm())
circuit = OPENQASM2Language().decode(qasm2.dumps(qc))
# circuit.renumber_qudits(list(reversed(range(circuit.num_qudits))))
return circuit
# TODO: support gates not captured by qasm
Expand Down
2 changes: 1 addition & 1 deletion bqskit/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This module contains the version information for BQSKit."""
from __future__ import annotations
__version_info__ = ('1', '1', '1')
__version_info__ = ('1', '1', '2')
__version__ = '.'.join(__version_info__[:3]) + ''.join(__version_info__[3:])
16 changes: 8 additions & 8 deletions tests/ext/test_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ def bqskit_circuit(self) -> Circuit:
@pytest.fixture
def qiskit_circuit(self) -> QuantumCircuit:
circuit = QuantumCircuit(3)
circuit.cnot(0, 1)
circuit.cx(0, 1)
circuit.u(1, 2, 3, 0)
circuit.u(1, 2, 3, 1)
circuit.u(1, 2, 3, 2)
circuit.cnot(0, 1)
circuit.cnot(0, 2)
circuit.cnot(0, 2)
circuit.cx(0, 1)
circuit.cx(0, 2)
circuit.cx(0, 2)
circuit.u(1, 2.4, 3, 0)
circuit.u(1, 2.2, 3, 1)
circuit.u(1, 2.1, 3, 2)
circuit.u(1, 2.1, 3, 2)
circuit.cnot(0, 2)
circuit.cnot(0, 2)
circuit.cnot(0, 1)
circuit.cnot(0, 2)
circuit.cx(0, 2)
circuit.cx(0, 2)
circuit.cx(0, 1)
circuit.cx(0, 2)
circuit.u(1, 2.4, 3, 0)
circuit.u(1, 2.2, 3, 1)
circuit.u(1, 2.1, 3, 2)
Expand Down
Loading