From 6d7373e41f47453e75c01abef26b0ae5cba79f8f Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Fri, 16 Aug 2024 11:11:27 +0100 Subject: [PATCH 1/5] Fix conversion of symbols into qiskit. --- pytket/extensions/qiskit/qiskit_convert.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pytket/extensions/qiskit/qiskit_convert.py b/pytket/extensions/qiskit/qiskit_convert.py index 69edbc53..0f2a06a7 100644 --- a/pytket/extensions/qiskit/qiskit_convert.py +++ b/pytket/extensions/qiskit/qiskit_convert.py @@ -35,6 +35,7 @@ import numpy as np from symengine import sympify # type: ignore +from symengine.lib import symengine_wrapper import sympy import qiskit.circuit.library.standard_gates as qiskit_gates # type: ignore @@ -846,7 +847,9 @@ def tk_to_qiskit( # See Parameter.__init__() in qiskit/circuit/parameter.py. new_p = Parameter(p_name) new_p._uuid = uuid - new_p._parameter_keys = frozenset(((p_name, uuid),)) + new_p._parameter_keys = frozenset( + ((symengine_wrapper.Symbol(p_name), uuid),) + ) new_p._hash = hash((new_p._parameter_keys, new_p._symbol_expr)) updates[p] = new_p qcirc.assign_parameters(updates, inplace=True) From 85c65473df06bd085f867d640ce4b99367e8f375 Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Fri, 16 Aug 2024 11:12:31 +0100 Subject: [PATCH 2/5] Update changelog. --- docs/changelog.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 83be035e..bec5336a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Changelog ~~~~~~~~~ +Unreleased +---------- + +* Fix conversion of symbols into qiskit. + 0.55.0 (July 2024) ------------------ From c3ad72f7354f1be1ae7f0ceb93a1ccbf85d4e34e Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Fri, 16 Aug 2024 11:14:33 +0100 Subject: [PATCH 3/5] Require qiskit >= 1.2.0. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 85e001e0..864aa2f9 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ include_package_data=True, install_requires=[ "pytket >= 1.30.0", - "qiskit >= 1.1", + "qiskit >= 1.2.0", "qiskit-algorithms >= 0.3.0", "qiskit-ibm-runtime >= 0.24.1", "qiskit-aer >= 0.14.2", From 4d6a087c56ea101c98e8c0481c81334185a16abf Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Fri, 16 Aug 2024 11:15:04 +0100 Subject: [PATCH 4/5] Update changelog. --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index bec5336a..e3b57ccf 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,7 @@ Unreleased ---------- * Fix conversion of symbols into qiskit. +* Require qiskit >= 1.2.0. 0.55.0 (July 2024) ------------------ From 4d57b4bd5b281b47b92e91745af08dd6465ab11a Mon Sep 17 00:00:00 2001 From: Alec Edgington Date: Fri, 16 Aug 2024 11:26:51 +0100 Subject: [PATCH 5/5] Pacify mypy. --- pytket/extensions/qiskit/qiskit_convert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytket/extensions/qiskit/qiskit_convert.py b/pytket/extensions/qiskit/qiskit_convert.py index 0f2a06a7..116997aa 100644 --- a/pytket/extensions/qiskit/qiskit_convert.py +++ b/pytket/extensions/qiskit/qiskit_convert.py @@ -35,7 +35,7 @@ import numpy as np from symengine import sympify # type: ignore -from symengine.lib import symengine_wrapper +from symengine.lib import symengine_wrapper # type: ignore import sympy import qiskit.circuit.library.standard_gates as qiskit_gates # type: ignore