-
Notifications
You must be signed in to change notification settings - Fork 36
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
Operation
: interface for QuantumCircuit
operations
#25
Conversation
@jakelishman, many thanks for taking the discussion on the We agree that we do not want Regarding the transpilation process. I am in favor of having a special transpiler pass for each
The suggested interface also means that To better understand the difference between Implementation-wise, the proof-of-concept 7966 on adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, the proposal seems straightforward and matches up with my memory of discussions on this topic. Qiskit/qiskit#7966 is starting the implementation here by adding the base class operation class and the required parameters of name and num_qubits. After that merges we can work on expanding the class definition with the parameter spec (which I assume will involve #26) and the state (which I'll need to write a design doc for) fields. I'm not sure if we want to resolve the questions before merging this. At least questions 2 and 3 have clear answering to me.
2. Will classical operations also be `Operation`, or will we do something | ||
different with them? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me I think it makes the most sense to have classical operations be based on the same base class. We can specialize on top of it if there are stricter requirements, but having a common class for all operations makes working with circuits internally a lot easier I think. Is thing a operation, if so we can use it in a circuit? Then for things consuming circuits at a low level (like qpy) know how to work with the base element in the circuit.
3. What information about necessary qubits should we expose, bearing in mind | ||
that the "number of qubits needed" may be dependent on the synthesis method? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just the number of qubits the operation acts on directly. If a synthesis method requires an ancilla, it's the responsibility of the synthesis method to know that check and either fallback to some other synthesis method or error appropriately if it can't work.
Co-authored-by: Matthew Treinish <[email protected]>
I'll merge and close this, given it's already landed in Terra. |
Whoops, pressed close by accident. I don't have merge power on this repo, as it turns out. |
I'm hoping to give us a place to keep notes from meetings, and a place to discuss asynchronously/offline on this proposed new interface. For the first pass, I've tried to write up my understanding of what's been discussed so far, but feel free to challenge my interpretations on those - that's what this is here for.
Other people who have been very involved in this discussion previously:
and some people who I think are also invested and may want to comment on the process: