|
1 | 1 | import abc |
2 | | -from itertools import product |
3 | 2 | from dataclasses import field, dataclass |
4 | 3 |
|
5 | 4 |
|
@@ -211,45 +210,6 @@ def join_binary_probs(cls, p1: float, *args: float) -> float: |
211 | 210 | p2 = cls.join_binary_probs(*args) |
212 | 211 | return p1 * (1 - p2) + p2 * (1 - p1) |
213 | 212 |
|
214 | | - @classmethod |
215 | | - def join_channels( |
216 | | - cls, |
217 | | - tuple_1: tuple[float, float, float, float], |
218 | | - tuple_2: tuple[float, float, float, float], |
219 | | - ) -> tuple[float, float, float, float]: |
220 | | - """Join two channels together by taking the maximum of each channel. |
221 | | -
|
222 | | - Assumes that -X, -Y, and -Z are the same as X, Y, and Z respectively. |
223 | | -
|
224 | | - Args: |
225 | | - tuple_1 (tuple[float, float, float, float]): The first channel. contains the following: |
226 | | - (px_1, py_1, pz_1, p_loss_1) |
227 | | - tuple_2 (tuple[float, float, float, float]): The second channel. contains the following: |
228 | | - (px_2, py_2, pz_2, p_loss_2) |
229 | | - Returns: |
230 | | - tuple[float, float, float, float]: The joined probabilities for each channel. |
231 | | -
|
232 | | - """ |
233 | | - px_1, py_1, pz_1, p_loss_1 = tuple_1 |
234 | | - px_2, py_2, pz_2, p_loss_2 = tuple_2 |
235 | | - |
236 | | - p1_dict = {"I": 1 - (px_1 + py_1 + pz_1), "X": px_1, "Y": py_1, "Z": pz_1} |
237 | | - p2_dict = {"I": 1 - (px_2 + py_2 + pz_2), "X": px_2, "Y": py_2, "Z": pz_2} |
238 | | - p_out = {} |
239 | | - |
240 | | - for key1, key2 in product(p1_dict.keys(), p2_dict.keys()): |
241 | | - key = cls.PAULI_RULE[key1 + key2] |
242 | | - if key == "I": |
243 | | - continue |
244 | | - p_out[key] = p_out.setdefault(key, 0.0) + p1_dict[key1] * p2_dict[key2] |
245 | | - |
246 | | - return ( |
247 | | - p_out["X"], |
248 | | - p_out["Y"], |
249 | | - p_out["Z"], |
250 | | - cls.join_binary_probs(p_loss_1, p_loss_2), |
251 | | - ) |
252 | | - |
253 | 213 |
|
254 | 214 | @dataclass(frozen=True) |
255 | 215 | class TwoRowZoneModel(MoveNoiseModelABC): |
@@ -316,19 +276,8 @@ def parallel_cz_errors( |
316 | 276 | ) -> dict[tuple[float, float, float, float], list[int]]: |
317 | 277 | """Apply parallel gates by moving ctrl qubits to qarg qubits.""" |
318 | 278 | groups = self.deconflict(ctrls, qargs) |
319 | | - |
320 | | - num_groups = len(groups) |
321 | | - |
322 | | - mover_noise = self.join_channels(self.move_errors, self.cz_paired_errors) |
323 | | - sitter_noise = self.sitter_errors |
324 | | - |
325 | | - for _ in range(num_groups - 1): |
326 | | - mover_noise = self.join_channels(mover_noise, self.sitter_errors) |
327 | | - sitter_noise = self.join_channels(sitter_noise, self.sitter_errors) |
328 | | - |
329 | 279 | movers = sum((c + q for c, q in groups), ()) |
330 | | - |
331 | 280 | return { |
332 | | - mover_noise: sorted(movers), |
333 | | - sitter_noise: sorted(rest), |
| 281 | + self.move_errors: sorted(movers), |
| 282 | + self.sitter_errors: sorted(rest), |
334 | 283 | } |
0 commit comments