cirq_google.transformers.target_gatesets.sycamore_gateset.merge_swap_rzz_and_2q_unitaries
Merges 2-qubit connected components and adjacent cirq.SWAP
and cirq.ZZPowGate
gates.
cirq_google.transformers.target_gatesets.sycamore_gateset.merge_swap_rzz_and_2q_unitaries(
circuit: 'cirq.AbstractCircuit',
*,
context: Optional['cirq.TransformerContext'] = None,
merged_swap_rzz_tag: str = '_merged_swap_rzz',
merged_2q_component_tag: str = '_merged_2q_unitaries',
intermediate_result_tag: Optional[str] = None
) -> 'cirq.Circuit'
Does the following two transformations, in that order:
- Merges adjacent occurrences of
cirq.SWAP
and cirq.ZZPowGate
into a
cirq.CircuitOperation
tagged with merged_swap_rzz_tag
.
- Merges connected components of 1 and 2 qubit unitaries in the circuit into a
cirq.CircuitOperation
tagged with merged_2q_component_tag
, ignoring the newly
introduced tagged circuit operations added in Step-1.
Args |
circuit
|
Input circuit to transform. It will not be modified.
|
context
|
cirq.TransformerContext storing common configurable options for transformers.
|
merged_swap_rzz_tag
|
Tag to apply on newly introduced circuit operations wrapping adjacent
cirq.SWAP and cirq.ZZPowGate s.
|
merged_2q_component_tag
|
Tag to apply on newly introduced circuit operations wrapping
connected components of 1 and 2 qubit unitaries.
|
intermediate_result_tag
|
If specified, the tag is added to newly introduced both the newly
introduced circuit operations encapsulating swap_rzz or 2q connected component.
|
Returns |
Copy of the transformed input circuit.
|
Raises |
ValueError
|
If merged_2q_component_tag and merged_swap_rzz_tag are equal.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-15 UTC."],[],[]]