Skip to content

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

Merged
merged 7 commits into from
Apr 15, 2025

Conversation

david-pl
Copy link
Collaborator

Closes #15

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.
@david-pl david-pl requested review from Roger-luo and weinbe58 April 15, 2025 09:12
Copy link
Contributor

github-actions bot commented Apr 15, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6158 5280 86% 0% 🟢

New Files

File Coverage Status
src/bloqade/pyqrack/qasm2/glob.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
src/bloqade/pyqrack/_init_.py 100% 🟢
src/bloqade/pyqrack/qasm2/core.py 80% 🟢
src/bloqade/pyqrack/reg.py 97% 🟢
src/bloqade/qasm2/glob.py 100% 🟢
TOTAL 94% 🟢

updated for commit: e13a264 by action🐍

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link
Member

@weinbe58 weinbe58 left a 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.

Comment on lines 84 to 85
@interp.impl(glob.UGate)
def ugate(self, interp: PyQrackInterpreter, frame: interp.Frame, stmt: glob.UGate):
Copy link
Member

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.

)

for qreg in registers:
for qarg in qreg:
Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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.

@david-pl david-pl merged commit 6020870 into main Apr 15, 2025
11 checks passed
@david-pl david-pl deleted the david/pyqrack-qasm2-glob branch April 15, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing runtime implementation for glob dialect
3 participants