You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using pytket-qiskit package to get circuits between tket and qiskit via qiskit_to_tk and tk_to_qiskit functions. In particular, circuits involving CnZ gates in tket are so convenient, such that I was creating them in tket and transferring to qiskit.
Recently though some updates in tket, qiskit and pytket-qiskit packages created some issues. Some issues are simple, such as the nomenclatura changes from auto_rebases_pass to AutoRebase. But, some are more fundamental. The tk_to_qiskit function, upon encountering circuits involving CnZ gates, now returning the following error:
File [~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/pytket/extensions/qiskit/qiskit_convert.py:1031](http://localhost:8888/lab/workspaces/auto-e/tree/Dropbox/aQa/aQa_codes/Class_H_Learn/shadow_first_hypergraph/pythonProject1/~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/pytket/extensions/qiskit/qiskit_convert.py#line=1030), in tk_to_qiskit(tkcirc, replace_implicit_swaps, perm_warning)
1028 supported_gate_rebase.apply(tkc)
1030 for command in tkc:
-> 1031 append_tk_command_to_qiskit(
1032 command.op, command.args, qcirc, qregmap, cregmap, symb_map, range_preds
1033 )
1034 qcirc.global_phase += param_to_qiskit(tkc.phase, symb_map)
1036 # if UUID stored in name, set parameter uuids accordingly (see qiskit_to_tk)
File [~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/pytket/extensions/qiskit/qiskit_convert.py:886](http://localhost:8888/lab/workspaces/auto-e/tree/Dropbox/aQa/aQa_codes/Class_H_Learn/shadow_first_hypergraph/pythonProject1/~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/pytket/extensions/qiskit/qiskit_convert.py#line=885), in append_tk_command_to_qiskit(op, args, qcirc, qregmap, cregmap, symb_map, range_preds)
884 if optype == OpType.CnZ:
885 new_gate = qiskit_gates.ZGate().control(len(qargs) - 1)
--> 886 new_gate.name = "mcz"
887 return qcirc.append(new_gate, qargs)
888 if optype == OpType.CnRy:
889 # might as well do a bit more checking
File [~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/qiskit/circuit/singleton.py:312](http://localhost:8888/lab/workspaces/auto-e/tree/Dropbox/aQa/aQa_codes/Class_H_Learn/shadow_first_hypergraph/pythonProject1/~/.pyenv/versions/jaxqml/lib/python3.12/site-packages/qiskit/circuit/singleton.py#line=311), in _impl_init_subclass.<locals>.__init_subclass__.<locals>._Singleton.__setattr__(self, key, value)
311 def __setattr__(self, key, value):
--> 312 raise TypeError(
313 f"This '{self.base_class.__name__}' object is immutable."
314 " You can get a mutable version by calling 'to_mutable()'."
315 )
TypeError: This 'CZGate' object is immutable. You can get a mutable version by calling 'to_mutable()'.
I was wondering if you can fix this issue.
Best,
Onur
The text was updated successfully, but these errors were encountered:
Which version of pytket-qiskit, pytket and qiskit are you using? The following code works fine for the with the latest version of pytket-qiskit (0.63.0) If you could include code to reproduce your issue that would be great.
Hi,
I was using pytket-qiskit package to get circuits between tket and qiskit via
qiskit_to_tk
andtk_to_qiskit
functions. In particular, circuits involving CnZ gates in tket are so convenient, such that I was creating them in tket and transferring to qiskit.Recently though some updates in tket, qiskit and pytket-qiskit packages created some issues. Some issues are simple, such as the nomenclatura changes from
auto_rebases_pass
toAutoRebase
. But, some are more fundamental. Thetk_to_qiskit
function, upon encountering circuits involving CnZ gates, now returning the following error:I was wondering if you can fix this issue.
Best,
Onur
The text was updated successfully, but these errors were encountered: