Skip to content

Ensure SycamoreGate instances are preserved over serialization#7093

Merged
dstrain115 merged 2 commits intoquantumlib:mainfrom
dstrain115:fsimgate_directly_to_syc
Feb 26, 2025
Merged

Ensure SycamoreGate instances are preserved over serialization#7093
dstrain115 merged 2 commits intoquantumlib:mainfrom
dstrain115:fsimgate_directly_to_syc

Conversation

@dstrain115
Copy link
Copy Markdown
Collaborator

  • Put in a special case for fsimgate deserialization so that sycamore gates are serialized to that representation.
  • This will avoid potential floating point errors when deserializing.

- Put in a special case for fsimgate deserialization so that
sycamore gates are serialized to that representation.
- This will avoid potential floating point errors when deserializing.
@dstrain115 dstrain115 requested review from a team, verult, vtomole and wcourtney as code owners February 24, 2025 19:24
@CirqBot CirqBot added the size: S 10< lines changed <50 label Feb 24, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.17%. Comparing base (db08b9b) to head (4107740).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7093      +/-   ##
==========================================
- Coverage   98.17%   98.17%   -0.01%     
==========================================
  Files        1089     1089              
  Lines       95217    95202      -15     
==========================================
- Hits        93480    93464      -16     
- Misses       1737     1738       +1     

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

and np.isclose(theta, np.pi / 2)
and np.isclose(phi, np.pi / 6)
):
op = SYC(*qubits)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What happens if the SYC gate also has the FSimViaModelTag?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call. Added a condition so that it does not convert to SYC if it is tagged.

Copy link
Copy Markdown
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

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

Thanks, Doug!

@dstrain115 dstrain115 added this pull request to the merge queue Feb 26, 2025
Merged via the queue into quantumlib:main with commit 8f2f198 Feb 26, 2025
@dstrain115 dstrain115 deleted the fsimgate_directly_to_syc branch February 26, 2025 23:33
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
…umlib#7093)

* Ensure SycamoreGate instances are preserved over serialization

- Put in a special case for fsimgate deserialization so that
sycamore gates are serialized to that representation.
- This will avoid potential floating point errors when deserializing.

* Don't convert to SYC if tags on the FSim.
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.

4 participants