From b42946e54230c61bb9b65037f5ae6e31f7b19ab2 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:48:36 +0100 Subject: [PATCH] fix handling of parameterised gate --- pytket/extensions/qiskit/qiskit_convert.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pytket/extensions/qiskit/qiskit_convert.py b/pytket/extensions/qiskit/qiskit_convert.py index 747e0255..93bc9791 100644 --- a/pytket/extensions/qiskit/qiskit_convert.py +++ b/pytket/extensions/qiskit/qiskit_convert.py @@ -24,6 +24,7 @@ cast, TypeVar, TYPE_CHECKING, + Type, ) from inspect import signature from uuid import UUID @@ -705,18 +706,18 @@ def append_tk_command_to_qiskit( pytket_control_state: list[bool] = op.get_control_state_bits() qiskit_control_state: str = _get_qiskit_control_state(pytket_control_state) try: - base_qiskit_gate, phase = _known_gate_rev_phase[op.get_op().type] + gatetype, phase = _known_gate_rev_phase[op.get_op().type] except KeyError: raise NotImplementedError( "Conversion of QControlBox with base gate" + f"{op.get_op()} not supported by tk_to_qiskit." ) - - qiskit_controlled_gate: ControlledGate = base_qiskit_gate().control( - num_ctrl_qubits=op.get_n_controls(), ctrl_state=qiskit_control_state - ) + params = _get_params(op.get_op(), symb_map) + operation = gatetype(*params) return qcirc.append( - qiskit_controlled_gate, + operation.control( + num_ctrl_qubits=op.get_n_controls(), ctrl_state=qiskit_control_state + ), qargs=qargs, )