-
Notifications
You must be signed in to change notification settings - Fork 1
Implement pyqrack interpreter method for qasm2 glob.u gate #152
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
Conversation
The wrapper was already in use in a bunch of places with this order, but using named arguments so it never errored. Still this should be consistent and I stuck with the order of the wrapper as it is already used.
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
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.
left some minor comments.
src/bloqade/pyqrack/qasm2/core.py
Outdated
@interp.impl(glob.UGate) | ||
def ugate(self, interp: PyQrackInterpreter, frame: interp.Frame, stmt: glob.UGate): |
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 method needs to be implemented in a method table registered by glob.dialect
. The convention is to put a method table inside a module with the same name as the dialect.
src/bloqade/pyqrack/qasm2/core.py
Outdated
) | ||
|
||
for qreg in registers: | ||
for qarg in qreg: |
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.
You can also implement the __iter__
magic method for PyQrackReg
to get the correct behavior here.
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.
Do you have any preference? I mean, it works just fine with using __getitem__
and an IndexError
, but it's probably not the cleanest implementation.
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 would add a TODO to clean up the whole class entirely I think we could rework the implementation to use list
as a base class to avoid all of these issues. But this should be a lower priority.
add something by PyQrackReg
to TODO: Clean up implementation with list base class
.
Closes #15