Example #1
0
    def __init__(self, initial_mapping: LogicalMapping) -> None:
        """Inits LogicalAnnotator.

        Args:
            initial_mapping: The initial mapping of qubits to logical indices.
        """
        self._initial_mapping = initial_mapping.copy()
Example #2
0
    def __init__(self, gates: LogicalGates,
                 initial_mapping: LogicalMapping) -> None:
        """
        Args:
            gates: The gates to insert.
            initial_mapping: The initial mapping of qubits to logical indices.
        """

        if len(set(len(indices) for indices in gates)) > 1:
            raise NotImplementedError(
                'Can only implement greedy strategy if all gates '
                'are of the same arity.')
        self.index_set_to_gates = self.canonicalize_gates(gates)
        self._initial_mapping = initial_mapping.copy()
Example #3
0
    def __init__(
        self, gates: LogicalGates, initial_mapping: LogicalMapping, device: 'cirq.Device' = None
    ) -> None:
        """Inits GreedyExecutionStrategy.

        Args:
            gates: The gates to insert.
            initial_mapping: The initial mapping of qubits to logical indices.
        """

        if len(set(len(indices) for indices in gates)) > 1:
            raise NotImplementedError(
                'Can only implement greedy strategy if all gates are of the same arity.'
            )
        self.index_set_to_gates = self.canonicalize_gates(gates)
        self._initial_mapping = initial_mapping.copy()
        self._device = device or devices.UNCONSTRAINED_DEVICE