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

update conversion to use symengine #314

Merged
merged 3 commits into from
Apr 5, 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
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.51.0"
__extension_version__ = "0.51.1rc0"
__extension_name__ = "pytket-qiskit"
5 changes: 3 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Changelog
~~~~~~~~~

Unreleased
----------
0.51.1rc0 (April 2024)
----------------------

* Update pytket version requirement to 1.26.
* Update qiskit-aer version requirement to 0.14.
* Update conversion to qiskit to use symengine for symbolic circuits

0.51.0 (March 2024)
-------------------
Expand Down
7 changes: 4 additions & 3 deletions pytket/extensions/qiskit/qiskit_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from uuid import UUID

import numpy as np
from symengine import sympify # type: ignore

import sympy
import qiskit.circuit.library.standard_gates as qiskit_gates # type: ignore
Expand Down Expand Up @@ -580,7 +581,7 @@ def param_to_qiskit(
if len(ppi.free_symbols) == 0:
return float(ppi.evalf())
else:
return ParameterExpression(symb_map, ppi)
return ParameterExpression(symb_map, sympify(ppi))


def _get_params(
Expand Down Expand Up @@ -724,7 +725,7 @@ def append_tk_command_to_qiskit(

if optype == OpType.TK1:
params = _get_params(op, symb_map)
half = ParameterExpression(symb_map, sympy.pi / 2)
half = ParameterExpression(symb_map, sympify(sympy.pi / 2))
qcirc.global_phase += -params[0] / 2 - params[2] / 2
return qcirc.append(
qiskit_gates.UGate(params[1], params[0] - half, params[2] + half),
Expand All @@ -749,7 +750,7 @@ def append_tk_command_to_qiskit(
if type(phase) == float:
qcirc.global_phase += phase * np.pi
else:
qcirc.global_phase += phase * sympy.pi
qcirc.global_phase += sympify(phase * sympy.pi)
return qcirc.append(g, qargs=qargs)


Expand Down