-
Notifications
You must be signed in to change notification settings - Fork 984
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
Add GridQid class #2861
Add GridQid class #2861
Conversation
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.
Good start.
>>> cirq.GridQubit(2, 3) - (1, 2) | ||
cirq.GridQubit(1, 1) | ||
""" | ||
@functools.total_ordering |
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.
Why total_ordering
?
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.
jbc that's what _BaseLineQid uses; I was confused bc it seemed like Qid implements all the rich comparison functions, but figured there was a reason for it to be there: possibly removable from both _BaseLineQid and _BaseGridQid?
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.
It might be a performance optimization somehow. But normally it requires you to define e.g. __lt__
…rns GridQid, corrected filename in helpful error
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.
LGTM
Adds GridQid class to match LineQid, to support grid systems with dimension !=2