Skip to content

Add a symbolize transformer #7307

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

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

Conversation

babacry
Copy link
Collaborator

@babacry babacry commented Apr 30, 2025

Symbolizes single qubit gates by tags.

Example:
Input:

        0: ───X[phxz_0]───@───Y[phxz_1]───X───
                          │
        1: ───────────────@───────────────────

$ cirq.symbolize_single_qubit_gates_by_indexed_tags(c, tag_prefix="phxz")
Output:

        0: ───PhXZ(a=a0,x=x0,z=z0)───@───PhXZ(a=a1,x=x1,z=z1)───X───
                                     │
        1: ──────────────────────────@──────────────────────────────

where, a0,x0,z0,a1,x1,z1 are symbols.

Context: to be used in #6994.

Copy link

codecov bot commented Apr 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.67%. Comparing base (b136ae8) to head (ede422f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7307   +/-   ##
=======================================
  Coverage   98.67%   98.67%           
=======================================
  Files        1111     1113    +2     
  Lines       96811    96856   +45     
=======================================
+ Hits        95528    95573   +45     
  Misses       1283     1283           

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

@babacry babacry force-pushed the symbolize branch 2 times, most recently from 1d6daf6 to 6d50406 Compare April 30, 2025 20:43
@babacry babacry removed the request for review from 95-martin-orion May 1, 2025 01:54
@babacry
Copy link
Collaborator Author

babacry commented May 1, 2025

@NoureldinYosri , phxz symbolizer transformer! Could you help review?

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 but lets make the tag a class instead of a string, for example

@attrs.frozen
class SymbolizeTag:
    prefix: str

@babacry
Copy link
Collaborator Author

babacry commented May 8, 2025

overall looks good but lets make the tag a class instead of a string, for example

@attrs.frozen
class SymbolizeTag:
    prefix: str

Good point, done.

@babacry babacry requested a review from NoureldinYosri May 8, 2025 05:17
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.

2 participants