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

Fix symbol conversion into qiskit #377

Merged
merged 5 commits into from
Aug 16, 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
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
~~~~~~~~~

Unreleased
----------

* Fix conversion of symbols into qiskit.
* Require qiskit >= 1.2.0.

0.55.0 (July 2024)
------------------

Expand Down
5 changes: 4 additions & 1 deletion pytket/extensions/qiskit/qiskit_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import numpy as np
from symengine import sympify # type: ignore
from symengine.lib import symengine_wrapper # type: ignore

import sympy
import qiskit.circuit.library.standard_gates as qiskit_gates # type: ignore
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down