View source on GitHub |
A greedy execution strategy.
Inherits From: ExecutionStrategy
cirq.contrib.acquaintance.GreedyExecutionStrategy(
gates: cirq.contrib.acquaintance.executor.LogicalGates
,
initial_mapping: cirq.contrib.acquaintance.executor.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:
cirq.contrib.acquaintance.executor.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[cirq.contrib.acquaintance.executor.LogicalIndex
],
qubits: Sequence['cirq.Qid']
) -> '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
|