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

Use group_interchangeable_qubits for qubit comparison in GateOperation #4941

Merged
merged 5 commits into from
Feb 3, 2022

Conversation

Ashalynd
Copy link
Collaborator

@Ashalynd Ashalynd commented Feb 3, 2022

Fix for issue #4766
Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.

@Ashalynd Ashalynd requested review from cduck, vtomole and a team as code owners February 3, 2022 01:07
@Ashalynd Ashalynd requested a review from dstrain115 February 3, 2022 01:07
@CirqBot CirqBot added the size: S 10< lines changed <50 label Feb 3, 2022
@Ashalynd Ashalynd added the Ready for Re-Review For when reviewers take their time. label Feb 3, 2022
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

Looks good, just a little readability cleanup then we should be good to merge.

Comment on lines 152 to 158
return tuple(
(k, frozenset(g for _, g in kg))
for k, kg in itertools.groupby(
enumerate(self.qubits),
lambda i_q: cast(
gate_features.InterchangeableQubitsGate, self.gate
).qubit_index_to_equivalence_group_key(i_q[0]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we break this up into a few simpler lines ? This is a little hard to read.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

LGTM

@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Feb 3, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Feb 3, 2022
@CirqBot CirqBot merged commit f18fde4 into quantumlib:master Feb 3, 2022
@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 Feb 3, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
quantumlib#4941)

Fix for issue quantumlib#4766 
Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
quantumlib#4941)

Fix for issue quantumlib#4766 
Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for Re-Review For when reviewers take their time. size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants