Skip to content
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

Support inverse gate JSON seralization #6912

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

Conversation

justinpan0
Copy link

Response to issue #6769

Fix validation

Running the code snippet provided in #6769 now yields correct result:

0: ───[0>0]──────
      │
1: ───[1>1]──────
      │
2: ───[2>2]^-1───
{
  "cirq_type": "Circuit",
  "moments": [
    {
      "cirq_type": "Moment",
      "operations": [
        {
          "cirq_type": "GateOperation",
          "gate": {
            "cirq_type": "_InverseCompositeGate",
            "val": {
              "cirq_type": "QubitPermutationGate",
              "permutation": [
                0,
                1,
                2
              ]
            }
          },
          "qubits": [
            {
              "cirq_type": "LineQubit",
              "x": 0
            },
            {
              "cirq_type": "LineQubit",
              "x": 1
            },
            {
              "cirq_type": "LineQubit",
              "x": 2
            }
          ]
        }
      ]
    }
  ]
}
0: ───[0>0]──────
      │
1: ───[1>1]──────
      │
2: ───[2>2]^-1───

@justinpan0 justinpan0 requested review from vtomole and a team as code owners January 3, 2025 07:06
@justinpan0 justinpan0 requested a review from senecameeks January 3, 2025 07:06
@CirqBot CirqBot added the size: S 10< lines changed <50 label Jan 3, 2025
Copy link

codecov bot commented Jan 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (83a8e0e) to head (1ce0c5d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6912   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files        1084     1084           
  Lines       94290    94293    +3     
=======================================
+ Hits        92280    92283    +3     
  Misses       2010     2010           

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

Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

LGTM pending one comment.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

Please, see the inline comment - we should use _InverseCompositeGate directly to construct the object.

Otherwise LGTM, thank you for fixing this!

@justinpan0 justinpan0 force-pushed the inverse-gate-json-serial branch from 1ce0c5d to 430a6e0 Compare January 11, 2025 07:12
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