CQCL / pytket-qiskit

pytket-qiskit, extensions for pytket quantum SDK
Apache License 2.0
16 stars 13 forks source link

Issue when using `tk_to_qiskit` with parameterized quantum circuits #224

Closed nquetschlich closed 8 months ago

nquetschlich commented 9 months ago

Hi there,

when executing the following code when combining qiskit compilation passes with pytket ones for a parameterized circuit with a certain desired basis gateset:

from qiskit.transpiler.passes import BasisTranslator
from qiskit.circuit.equivalence_library import StandardEquivalenceLibrary
from qiskit.providers.fake_provider import FakeGuadalupe
from pytket.passes import CliffordSimp
from qiskit.transpiler import PassManager
from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
from pytket.extensions.qiskit import qiskit_to_tk, tk_to_qiskit

pass_1 = BasisTranslator(StandardEquivalenceLibrary, target_basis=FakeGuadalupe().configuration().basis_gates)
pass_2 = CliffordSimp()

qc = QuantumCircuit(2)
qc.ryy(Parameter('0'), 0, 1)

pm = PassManager(pass_1)
qc = pm.run(qc)

tket_qc = qiskit_to_tk(qc)
pass_2.apply(tket_qc)
qc = tk_to_qiskit(tket_qc)

I get this error from the last line: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''.

I am using pytket_qiskit==0.45.0 with pytket==1.21.0 and qiskit==0.44.3 under MacOS 14 using Python 3.11.

cqc-melf commented 8 months ago

Thank you for reporting, should be solved now. I will put that in the next release