-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Instruction should include qubits it acts on #7788
Comments
With due respect/apologies if I'm wrong to Ali, I think he might not be aware of some things that have already been discussed in the internal Terra meetings with the rest of the team on this front over the last month or so. This hits some of the internal development strands for the year (e.g. dynamic circuits, 1000q compilation, etc). edit: to be clear, by "we" below I'm mostly referring to those in the fortnightly internal Terra meeting, and assigned to particular large-scale items on the roadmap (though wouldn't want to presume to speak for everyone), which is mostly people in the terra-core access group. We are actually already in the process of adding the encapsulating class that you want. Matthew made a PR that staled (#7020), but that will be obsoleted and closed by what Erick and I have been working on (related to #7624), which we need to manage changing this internal 3-tuple to a new, 4-component type while maintaining API stability. It will essentially be a slightly fiddly data class, with some iteration tricks to make it look like the old 3-tuple when people use it as one. The We're trying to move more state out of For you usability points:
|
Thanks @jakelishman, it's good to know there is work being done on this front. In |
For sure - it's kind of as a side effect, but I think what we're planning hits just about everything you want already. Yeah, that way of referring to qubit instances is my preferred way as well (and the most performant). I think at the moment we still need to be a little mindful of all the teaching docs we have out in the wild that promote integers as the primary method of indexing. Hopefully some of those problems will just solve themselves as we move to more dynamic circuits, where the output is no longer just one big flag classical register - just by default, indexing by instance will become more convenient once people aren't necessarily thinking about single registers. |
Oh, I forgot to respond to the nested iterables bit sorry: I'm not 100% convinced that we should put a "flatten" operation in (Right now it would be a bit messy internally to infer the qubits/clbits from only the encapsulated instruction iterable, because we'd have to duplicate some logic from |
Closing this as it's not the direction that's been taken for the data model, because we're separating the concept of "operation" ( |
What is the expected enhancement?
Qiskit currently lacks a class to represent the concept "a gate together with the qubits it acts on." This concept is useful because it is the basic unit a quantum circuit is composed of. For example, it can be the type of object appended to a circuit, so that
QuantumCircuit.append
can accept a single argument instead of multiple. It can also be used to simplify circuit construction in other ways; for example,circuit = QuantumCircuit(instructions)
whereinstructions
is an iterable of instructions (in fact it could be an "iterable tree" of instructions). After some discussion with @ajavadia we agree that the Instruction class could be updated to serve this purpose.The text was updated successfully, but these errors were encountered: