-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add cirq.CZTargetGateset
to replace cirq.ConvertToCZAndSingleGates
and cirq.MergeInteractions
#5007
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ed21b22
Add CZTargetGateset to replace ConvertToCZAndSingleGates and MergeInt…
tanujkhattar 843ee00
Remove sqrt iswap gateset import
tanujkhattar a00b9f8
Merge branch 'master' of https://github.com/quantumlib/cirq into cz_g…
tanujkhattar 05592e5
Merge branch 'master' of https://github.com/quantumlib/cirq into cz_g…
tanujkhattar 9f5d0ba
Merge branch 'master' of https://github.com/quantumlib/cirq into cz_g…
tanujkhattar 1077b05
Merge branch 'master' of https://github.com/quantumlib/cirq into cz_g…
tanujkhattar ce37819
Merge branch 'master' of https://github.com/quantumlib/cirq into cz_g…
tanujkhattar 968d2a8
Address feedback and add serialization support for CZTargetGateset.
tanujkhattar 53fa5bb
Flatten new optree before computing new_2q_gate_count so it works whe…
tanujkhattar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
cirq-core/cirq/protocols/json_test_data/CZTargetGateset.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"cirq_type": "CZTargetGateset", | ||
"atol": 1e-06, | ||
"allow_partial_czs": false | ||
}, | ||
{ | ||
"cirq_type": "CZTargetGateset", | ||
"atol": 1e-08, | ||
"allow_partial_czs": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
cirq.CZTargetGateset(atol=1e-06, allow_partial_czs=False), | ||
cirq.CZTargetGateset(atol=1e-08, allow_partial_czs=True), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: how did this happen ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens because the newly introduced transformer is moment-preserving. Specifically, the original circuit is:
In the first step, the following connected component gets merged and compiled:
as a result we have the following (moment-preserving) circuit:
whereas in the original workflow, the
CZ(1, 2)
would have overlapped withPhXZ
in moment-2. The final compilation step beyond this point (ConvertToPauliStringPhasors
) has not yet been migrated to the new primitives, as a result in the final output,CZ(1, 2)
is just shifted to the right by 1 unit but still overlaps with a single qubit gate introduced due toConvertToPauliStringPhasors
.This is technically a breaking change but I'm not too worried because it's in
contrib/
.