Skip to content
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

Merged
merged 20 commits into from
Mar 28, 2020
Merged

Add GridQid class #2861

merged 20 commits into from
Mar 28, 2020

Conversation

mmcewen-g
Copy link
Contributor

@mmcewen-g mmcewen-g commented Mar 26, 2020

Adds GridQid class to match LineQid, to support grid systems with dimension !=2

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Mar 26, 2020
Copy link
Contributor

@Strilanc Strilanc left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why total_ordering?

Copy link
Contributor Author

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?

Copy link
Contributor

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__

cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/grid_qubit.py Outdated Show resolved Hide resolved
cirq/devices/line_qubit.py Show resolved Hide resolved
@mmcewen-g mmcewen-g marked this pull request as ready for review March 26, 2020 22:28
@mmcewen-g mmcewen-g requested a review from Strilanc March 26, 2020 22:28
Copy link
Contributor

@Strilanc Strilanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Strilanc Strilanc added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 27, 2020
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 27, 2020
@CirqBot CirqBot merged commit 2dd6e2e into quantumlib:master Mar 28, 2020
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants