|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -from typing import Any, cast, FrozenSet, Iterable, Optional, Set, TYPE_CHECKING |
| 15 | +from typing import Any, FrozenSet, Iterable, Optional, Set, TYPE_CHECKING |
16 | 16 |
|
17 | 17 | from cirq import circuits, value, devices, ops, protocols
|
18 | 18 | from cirq.ion import convert_to_ion_gates
|
@@ -104,37 +104,10 @@ def validate_operation(self, operation):
|
104 | 104 | if q not in self.qubits:
|
105 | 105 | raise ValueError(f'Qubit not on device: {q!r}')
|
106 | 106 |
|
107 |
| - def _check_if_XXPow_operation_interacts_with_any( |
108 |
| - self, XXPow_op: ops.GateOperation, others: Iterable[ops.GateOperation] |
109 |
| - ) -> bool: |
110 |
| - return any(self._check_if_XXPow_operation_interacts(XXPow_op, op) for op in others) |
111 |
| - |
112 |
| - def _check_if_XXPow_operation_interacts( |
113 |
| - self, XXPow_op: ops.GateOperation, other_op: ops.GateOperation |
114 |
| - ) -> bool: |
115 |
| - if isinstance( |
116 |
| - other_op.gate, |
117 |
| - (ops.XPowGate, ops.YPowGate, ops.PhasedXPowGate, ops.MeasurementGate, ops.ZPowGate), |
118 |
| - ): |
119 |
| - return False |
120 |
| - |
121 |
| - return any(q == p for q in XXPow_op.qubits for p in other_op.qubits) |
122 |
| - |
123 | 107 | def validate_circuit(self, circuit: circuits.Circuit):
|
124 | 108 | super().validate_circuit(circuit)
|
125 | 109 | _verify_unique_measurement_keys(circuit.all_operations())
|
126 | 110 |
|
127 |
| - def can_add_operation_into_moment(self, operation: ops.Operation, moment: ops.Moment) -> bool: |
128 |
| - |
129 |
| - if not super().can_add_operation_into_moment(operation, moment): |
130 |
| - return False |
131 |
| - if isinstance(operation.gate, ops.XXPowGate): |
132 |
| - return not self._check_if_XXPow_operation_interacts_with_any( |
133 |
| - cast(ops.GateOperation, operation), |
134 |
| - cast(Iterable[ops.GateOperation], moment.operations), |
135 |
| - ) |
136 |
| - return True |
137 |
| - |
138 | 111 | def at(self, position: int) -> Optional[devices.LineQubit]:
|
139 | 112 | """Returns the qubit at the given position, if there is one, else None."""
|
140 | 113 | q = devices.LineQubit(position)
|
|
0 commit comments