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

Idea: Refactor qiskit_to_tk and tk_to_qiskit #313

Open
CalMacCQ opened this issue Apr 5, 2024 · 0 comments
Open

Idea: Refactor qiskit_to_tk and tk_to_qiskit #313

CalMacCQ opened this issue Apr 5, 2024 · 0 comments
Assignees
Labels
circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa enhancement New feature or request

Comments

@CalMacCQ
Copy link
Contributor

CalMacCQ commented Apr 5, 2024

The qiskit_to_tk and tk_to_qiskit converters are a frequent source of bug reports and feature requests from users. I suspect for a significant number of people these converters are their first exposure to using pytket and related libraries.

The code for doing the conversion is old and has been patched together over time. Its now about 1000 lines of untidy python. I think it could make the code simpler and more maintainable if we rethink/refactor the converters perhaps splitting out some of the compilcated case handling into separate internal functions.

I think this would save us time in the long run when addressing bugs and feature requests from users. May also make it easier for new contributors to make PRs.

A couple of thoughts...

  • pytket and extensions now support python 3.10, 3.11 and 3.12. This could allow us to make use of structural pattern matching (introduced in 3.10) in the circuit parsers.
  • I think having circuit converters which handle higher level circuit boxes is valuable as it allows easier (and fairer) side by side benchmarking of pytket vs qiskit. Also it allows qiskit users to try out pytket with less hassle. One could of course trivially just convert a pytket circuit to a qiskit circuit by exporting to and from QASM but this translation would be very lossy and remove abstractions which can be useful for the compiler. Handling more ops also expands the range of circuits we can run on the idealised AerBackend simulator.
@CalMacCQ CalMacCQ added enhancement New feature or request circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa labels Apr 5, 2024
@CalMacCQ CalMacCQ self-assigned this May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
circuit_conversion Issues and pull requests related to coverting qiskit circuits to pytket and vice versa enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant