quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Fix equality of cphase gates initialized from sympy constants #6669

Closed pavoljuhas closed 3 months ago

pavoljuhas commented 4 months ago

Problem: In sympy-1.13.0 the expressions sympy.S.One == 1.0 and sympy.S.Half == 0.5 evaluate to False which causes inequality between cirq.cphase(sympy.pi) and cirq.CZ.

Solution: Check equality with parametrized exponents converted to float.

Fixes: #6663

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.82%. Comparing base (3922a63) to head (5a24661). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6669 +/- ## ========================================== - Coverage 97.82% 97.82% -0.01% ========================================== Files 1068 1072 +4 Lines 91919 92030 +111 ========================================== + Hits 89917 90025 +108 - Misses 2002 2005 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.