![]() |
A greedy execution strategy.
Inherits From: ExecutionStrategy
cirq.contrib.acquaintance.GreedyExecutionStrategy(
gates: LogicalGates,
initial_mapping: LogicalMapping,
device: Optional[cirq.Device] = None
) -> None
When an acquaintance opportunity is reached, all gates acting on those qubits in any order are inserted.
Args | |
---|---|
gates
|
The gates to insert. |
initial_mapping
|
The initial mapping of qubits to logical indices. |
device
|
The device upon which to execute the strategy. |
Raises | |
---|---|
NotImplementedError
|
If not all gates are of the same arity. |
Attributes | |
---|---|
device
|
The device for which the executed acquaintance strategy should be valid. |
initial_mapping
|
The initial mapping of logical indices to qubits. |
Methods
canonicalize_gates
@staticmethod
canonicalize_gates( gates: LogicalGates ) -> Dict[frozenset, LogicalGates]
Canonicalizes a set of gates by the qubits they act on.
Takes a set of gates specified by ordered sequences of logical indices, and groups those that act on the same qubits regardless of order.
get_operations
get_operations(
indices: Sequence[LogicalIndex], qubits: Sequence[cirq.Qid]
) -> Iterator[cirq.OP_TREE]
Gets the logical operations to apply to qubits.
__call__
__call__(
*args, **kwargs
)
Returns the final mapping of logical indices to qubits after executing an acquaintance strategy.
Class Variables | |
---|---|
keep_acquaintance |
False
|