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

Fix EigenGate equality #7057

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

daxfohl
Copy link
Collaborator

@daxfohl daxfohl commented Feb 11, 2025

Fixes #7052. Also fixes #6764.

EigenGates of the same class generally differ only by the phases that they apply to each eigenspace. Therefore their _value_equality_values_ can be determined uniquely by calculating these phases. This is both faster (no need to calculate the period or canonical exponent) and more robust (exponentiation of phases is accounted for) than the existing implementation. The simplification also allows it to handle large global shifts that cause division-by-zero errors in period calculations (#6764). Additionally, many different edge cases with symbolic exponents are easier to identify and account for.

This also allows us to get rid of some superfluous _value_equality_values_ implementations in subclasses, except where the eigenspaces themselves are changeable.

@daxfohl daxfohl requested review from vtomole and a team as code owners February 11, 2025 19:57
@daxfohl daxfohl requested a review from maffoo February 11, 2025 19:57
@CirqBot CirqBot added the size: M 50< lines changed <250 label Feb 11, 2025
Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.17%. Comparing base (8f2f198) to head (5c13c13).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7057   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files        1089     1089           
  Lines       95232    95199   -33     
=======================================
- Hits        93495    93463   -32     
+ Misses       1737     1736    -1     

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

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

Successfully merging this pull request may close these issues.

EigenGate equality does not account for exponent when comparing global phase Optimizer failure
2 participants