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

Check identity first when comparing circuits #6375

Merged
merged 2 commits into from
Dec 19, 2023
Merged

Conversation

maffoo
Copy link
Contributor

@maffoo maffoo commented Dec 6, 2023

Add identity check to short-circuit exact and approximate equality checks on cirq.AbstractCircuit and subclasses. Also change the implementation of __eq__ to avoid creating new tuples of moments; instead we check the length and then zip over the moments.

@maffoo maffoo requested review from vtomole, cduck and a team as code owners December 6, 2023 00:32
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (be7b059) 97.80% compared to head (c494dfa) 97.81%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6375    +/-   ##
========================================
  Coverage   97.80%   97.81%            
========================================
  Files        1111     1111            
  Lines       96877    97037   +160     
========================================
+ Hits        94754    94914   +160     
  Misses       2123     2123            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maffoo maffoo merged commit 181d7aa into main Dec 19, 2023
38 checks passed
@maffoo maffoo deleted the u/maffoo/circuit-eq-id branch December 19, 2023 16:46
@maffoo maffoo changed the title Check value equality first when comparing circuits Check identity first when comparing circuits Dec 20, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
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.

2 participants