Skip to content

Conversation

dstrain115
Copy link
Collaborator

  • Adds classical conditions to cirq_google proto.
  • Adds fields to MeasurementKey to support various (possibly nested)
    conditions.
  • Centralize and generalize sympy operations. Add comparison operators
    (==, !=, <, >, <=, >=)
  • Add support for KeyCondition, SympyCondition, and BitMaskKeyCondition
  • Adds conditioned_on to Operation proto.
  • Adds repeat_until and conditioned_on to CircuitOperation proto.

dstrain115 and others added 8 commits April 3, 2025 15:31
- Adds support for (potentially nested) tuples of mismatched types
- Adds support for serializing ndarrays
- Adds support for serializing complex numbers
Co-authored-by: Pavol Juhas <pavol.juhas@gmail.com>
- Adds classical conditions to cirq_google proto.
- Adds fields to MeasurementKey to support various (possibly nested)
  conditions.
- Centralize and generalize sympy operations.  Add comparison operators
(==, !=, <, >, <=, >=)
- Add support for KeyCondition, SympyCondition, and BitMaskKeyCondition
- Adds conditioned_on to Operation proto.
- Adds repeat_until and conditioned_on to CircuitOperation proto.
@dstrain115 dstrain115 requested review from wcourtney, vtomole, verult and a team as code owners April 8, 2025 22:25
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.66%. Comparing base (bdf9249) to head (3ba6610).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7250      +/-   ##
==========================================
+ Coverage   98.64%   98.66%   +0.01%     
==========================================
  Files        1106     1106              
  Lines       95990    96049      +59     
==========================================
+ Hits        94691    94768      +77     
+ Misses       1299     1281      -18     

☔ 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.

@pavoljuhas
Copy link
Collaborator

@dstrain115 - do we need to include this in the upcoming 1.5.0 or can it wait for a dev version after?

@dstrain115
Copy link
Collaborator Author

It can wait.

@dstrain115 dstrain115 added the priority/after-1.5 Leave for after the Cirq 1.5 release label Apr 9, 2025
Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

overall looks good ... just a minor request to support this feature #6914

sympy.StrictGreaterThan: ">",
sympy.LessThan: "<=",
sympy.StrictLessThan: "<",
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

for SympyCondition we also need the bitswise functions And, OR, Not, Xor, sympy.Indexed and sympy.IndexedBase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@dstrain115 dstrain115 added this pull request to the merge queue Apr 9, 2025
Merged via the queue into quantumlib:main with commit 6e47e2e Apr 9, 2025
38 checks passed
@dstrain115 dstrain115 deleted the add_conditions_to_proto branch April 9, 2025 22:52
@pavoljuhas pavoljuhas removed the priority/after-1.5 Leave for after the Cirq 1.5 release label Apr 10, 2025
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
* Add tuples, ndarrays, and complex numbers to cirq_google proto

- Adds support for (potentially nested) tuples of mismatched types
- Adds support for serializing ndarrays
- Adds support for serializing complex numbers

* my o my, it's mypy

* Fix all the review comments, add set support.

* Fix invert mask, which assumes list, so it can accept tuples.

* Update cirq-google/cirq_google/serialization/arg_func_langs.py

Co-authored-by: Pavol Juhas <pavol.juhas@gmail.com>

* Fix coverage.

* Add classical conditions to cirq_google proto

- Adds classical conditions to cirq_google proto.
- Adds fields to MeasurementKey to support various (possibly nested)
  conditions.
- Centralize and generalize sympy operations.  Add comparison operators
(==, !=, <, >, <=, >=)
- Add support for KeyCondition, SympyCondition, and BitMaskKeyCondition
- Adds conditioned_on to Operation proto.
- Adds repeat_until and conditioned_on to CircuitOperation proto.

* Add use_repetitions_id

* Add sympy booleans and indexed.

* Fix indexed issue.

---------

Co-authored-by: Pavol Juhas <pavol.juhas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants