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

qiskit_to_tk does not work with exponentials in parameterized circuits #185

Closed
ruihao-li opened this issue Oct 8, 2023 · 4 comments
Closed
Labels
bug Something isn't working circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa

Comments

@ruihao-li
Copy link

ruihao-li commented Oct 8, 2023

Here is a minimal example in which I ran into error:

from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
from pytket.extensions.qiskit import qiskit_to_tk

K = Parameter("K")
kappa = K.exp()
qc = QuantumCircuit(1)
qc.rz(kappa, 0)

tk_backend = IBMQBackend("ibm_nairobi")
tk_qc = qiskit_to_tk(qc)

The error message I got was:

RuntimeError: Unable to convert sympy expression exp(K)

I tested with other functions such as arccos(), log(), and so on and they all worked. It seems it is only the exponential that is giving the problem.
Is there a workaround for this? Thanks!

qiskit version: 0.44.2
pytket-qiskit version: 0.44.0

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Oct 9, 2023

Thank you for making an issue. This definetly seems like a bug and something we should fix soon.

I can't immediately think of a workaround but if I do then I'll share it here.

@ruihao-li
Copy link
Author

Thank you! Look forward to the fix!

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Oct 10, 2023

Turns out this was caused by an issue with the bindings in tket itself. See the tket issue.

Fortunately this is now fixed in CQCL/tket#1069.

The fix will be in the next pytket release (coming soon) and the pytket-qiskit release is due shortly after.

Thanks again for rasing the issue.

@ruihao-li
Copy link
Author

Awesome! Please feel free to close this issue.

@CalMacCQ CalMacCQ added the circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa
Projects
None yet
Development

No branches or pull requests

2 participants