-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
…n._equal_up_to_global_phase
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.
Looks good, just a little readability cleanup then we should be good to merge.
cirq-core/cirq/ops/gate_operation.py
Outdated
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]), |
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.
Could we break this up into a few simpler lines ? This is a little hard to read.
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.
Done.
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
quantumlib#4941) Fix for issue quantumlib#4766 Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.
quantumlib#4941) Fix for issue quantumlib#4766 Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.
Fix for issue #4766
Also, Introduced more idiomatic code for group_interchangeable_qubits implementation.