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

Refactor circuit library to not subclass QuantumCircuit #12293

Open
4 tasks
mtreinish opened this issue Apr 23, 2024 · 0 comments
Open
4 tasks

Refactor circuit library to not subclass QuantumCircuit #12293

mtreinish opened this issue Apr 23, 2024 · 0 comments
Labels
mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library type: epic A theme of work that contain sub-tasks type: feature request New feature or request

Comments

@mtreinish
Copy link
Member

What should we add?

For qiskit 2.0 it would be good to refactor the circuit library to be a collection of circuit construction functions rather than QuantumCircuit subclasses. At the end of the day the majority of the classes in the circuit library are just using the constructor to build a QuantumCircuit and returning themselves and not specializing the circuit class. Moving to a function that returns a QuantumCircuit object will remove a layer in the type hierarchy and also make it clearer that the classes are just circuits. It also will make rust implementations of these functions easier after #12205 merges.

The one exception are the BlueprintCircuit classes. These try to adjust the internals of the QuantumCircuit to make them dynamically build (or rebuild/reconstruct if the properties change) based on provided properties. However, this functionality is not necessary anymore and it adds a lot of complexity to the classes that use it.

  • Add equivalent circuit construction functions for all the circuit classes and use them internally for __init__ (in non-BlueprintCircuit classes).
  • Deprecate the circuit classes and point to the new functions
  • Deprecate BlueprintCircuit
  • In Qiskit 2.0 remove all the QuantumCircuit subclasses in the circuit library.
@mtreinish mtreinish added type: feature request New feature or request type: epic A theme of work that contain sub-tasks mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library type: epic A theme of work that contain sub-tasks type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant