quantumlib / Cirq

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

Add a new gauge for SqrtCZ and support SqrtCZ† and fix and improve spin inversion gauge #6571

Closed NoureldinYosri closed 4 months ago

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 97.87234% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 97.78%. Comparing base (614c78a) to head (02caccb).

Files Patch % Lines
...cirq/transformers/gauge_compiling/sqrt_cz_gauge.py 94.73% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6571 +/- ## ========================================== - Coverage 97.79% 97.78% -0.01% ========================================== Files 1124 1124 Lines 95659 95699 +40 ========================================== + Hits 93550 93580 +30 - Misses 2109 2119 +10 ```

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

NoureldinYosri commented 5 months ago

@pavoljuhas when I use ops.CZ I get

cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py:28: error: Cannot determine type of "CZ"  [has-type]
pavoljuhas commented 4 months ago

@pavoljuhas when I use ops.CZ I get

cirq-core/cirq/transformers/gauge_compiling/sqrt_cz_gauge.py:28: error: Cannot determine type of "CZ"  [has-type]

This seems to happen because check/mypy cirq-core follows the import cirq loading order and that line is reached before the cirq.ops package is fully loaded. If gauge_compiling is not imported from transformers.__init__ the typecheck seems to pass.

Do we need to import gauge_compiling by default at import cirq or can it be an optional thing requiring import cirq.transformer.gauge_compiling to access?

If optional, we may save ourselves some headaches with circular imports or strange typechecking errors down the line.