def __init__(self, qubits: Sequence['cirq.Qid'], logical_indices: Sequence[LogicalIndex]) -> None: if len(logical_indices) != len(qubits): raise ValueError('len(logical_indices) != len(qubits)') super().__init__(AcquaintanceOpportunityGate(num_qubits=len(qubits)), qubits) self.logical_indices: LogicalIndexSequence = logical_indices
def __init__(self, qubits: Sequence[ops.raw_types.QubitId], logical_indices: Sequence[LogicalIndex]) -> None: if len(logical_indices) != len(qubits): raise ValueError('len(logical_indices) != len(qubits)') super().__init__(AcquaintanceOpportunityGate(num_qubits=len(qubits)), qubits) self.logical_indices = logical_indices # type: LogicalIndexSequence
def test_acquaintance_device(): with pytest.raises(ValueError): op = cirq.X(cirq.NamedQubit('q')) UnconstrainedAcquaintanceDevice.validate_operation(op) qubits = cirq.LineQubit.range(4) ACQUAINT = AcquaintanceOpportunityGate() swap_network = SwapNetworkGate((1, 2, 1)) UnconstrainedAcquaintanceDevice.validate_operation(ACQUAINT(*qubits[:2])) UnconstrainedAcquaintanceDevice.validate_operation(swap_network(*qubits))