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