Skip to content

Conversation

dstrain115
Copy link
Collaborator

  • Check gate families with tags before doing instance GateFamily checks.
  • This change will check cirq.GateFamily(cirq.ZPowGate, tags_to_accept=[PhysicalZ()]) before instance gate families.
  • We generally want to avoid checking instance gate families if at all possible, since they can call protocols.equal_up_to_global_phase which is quite slow.

- Check gate families with tags before doing instance GateFamily
  checks.
- This change will check cirq.GateFamily(cirq.ZPowGate,
  tags_to_accept=[PhysicalZ()]) before instance gate families.
- We generally want to avoid checking instance gate families if at
all possible, since they can call protocols.equal_up_to_global_phase
which is quite slow.
@dstrain115 dstrain115 requested review from vtomole and a team as code owners October 2, 2025 23:08
@dstrain115 dstrain115 requested a review from senecameeks October 2, 2025 23:08
@github-actions github-actions bot added the size: S 10< lines changed <50 label Oct 2, 2025
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.38%. Comparing base (3317377) to head (3d36232).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7692    +/-   ##
========================================
  Coverage   99.38%   99.38%            
========================================
  Files        1089     1089            
  Lines       97414    97535   +121     
========================================
+ Hits        96812    96934   +122     
+ Misses        602      601     -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

# Lastly, do a final exhaustive check to make sure this is not equivalent
# to another type of gate. This will catch things like:
# cirq.XPowGate(exponent=0) in cirq.GateFamily(cirq.I)
return any(item in gate_family for gate_family in self._gates)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably do self._gates.difference(self._gate_families_with_tags) because gfwt are already checked on line 451.

Comment on lines +332 to +334
print(gateset._gate_families_with_tags)
for g in gateset.gates:
print(f"{g} {gate in g}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

debug printouts?

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

LGTM after addressing comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants