View source on GitHub |
Replace every rectified moment with acquaintance gates with a generalized swap network.
cirq.contrib.acquaintance.replace_acquaintance_with_swap_network(
circuit: 'cirq.Circuit',
qubit_order: Sequence['cirq.Qid'],
acquaintance_size: Optional[int] = 0,
swap_gate: 'cirq.Gate' = cirq.SWAP
) -> bool
The generalized swap network has a partition given by the acquaintance gates in that moment (and singletons for the free qubits). Accounts for reversing effect of swap networks.
Returns: Whether or not the overall effect of the inserted swap network gates is to reverse the order of the qubits, i.e. the parity of the number of swap network gates inserted.
Raises | |
---|---|
TypeError
|
circuit is not an acquaintance strategy. |