Add support for using physical-Z phase matching on 2-qubit gates #3862
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.
When run on hardware, two-qubit gates must be "phase-matched" to account for the detuning between the rest frames of the two qubits. By default, this phase matching will use "virtual" Z gates where possible, namely for gates like CZ and iSWAP that commute with single-qubit Z rotations (in the case of iSWAP, the commuted Zs swap to the other qubit). In some cases, however, we may want to use "physical" Z gates for matching, for example to avoid errors due to non-ideal gates (non-zero swap angle in CZ, or incomplete swap in iSWAP).
Here we add support for tagging 2-qubit gates with
cirq.google.PhysicalZTag()
to indicate that physical Z gates should be used for matching, instead of the default matching scheme. We modify the 2-qubit gate serializers to recognize these tags and pass them through when serializing/deserializing.Note that for sqrt-iSWAP gates and others that do not commute with Z, the default behavior is already to use physical Z gates for matching. In these cases adding an explicit
PhysicalZTag()
does not change the behavior, but we allow it for consistency with other 2-qubit gates.