|
30 | 30 | d1 = cirq.NamedQubit('d1') |
31 | 31 |
|
32 | 32 |
|
| 33 | +@pytest.mark.parametrize('transformer', |
| 34 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 35 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
33 | 36 | @pytest.mark.parametrize('device', |
34 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
35 | | -def test_single_qubit_ops(device): |
36 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 37 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 38 | +def test_single_qubit_ops(transformer, device): |
37 | 39 | c = cirq.Circuit(cirq.X(a1), cirq.X(a2), cirq.X(a3)) |
38 | | - transformer.qubit_mapping(c) |
39 | | - c = transformer.transform(c) |
40 | | - device.validate_circuit(c) |
| 40 | + t = transformer(device) |
| 41 | + device.validate_circuit(t.transform(c)) |
41 | 42 |
|
42 | 43 |
|
| 44 | +@pytest.mark.parametrize('transformer', |
| 45 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 46 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
43 | 47 | @pytest.mark.parametrize('device', |
44 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
45 | | -def test_single_qubit_with_two_qubits(device): |
46 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 48 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 49 | +def test_single_qubit_and_two_qubits_ops(transformer, device): |
47 | 50 | c = cirq.Circuit(cirq.X(a1), cirq.X(a2), cirq.X(a3), |
48 | 51 | cirq.ISWAP(a3, a4) ** 0.5) |
49 | | - transformer.qubit_mapping(c) |
50 | | - device.validate_circuit(transformer.transform(c)) |
| 52 | + t = transformer(device) |
| 53 | + device.validate_circuit(t.transform(c)) |
51 | 54 |
|
52 | 55 |
|
| 56 | +@pytest.mark.parametrize('transformer', |
| 57 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 58 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
53 | 59 | @pytest.mark.parametrize('device', |
54 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
55 | | -def test_three_split_moves(device): |
56 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 60 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 61 | +def test_three_split_moves(transformer, device): |
57 | 62 | c = cirq.Circuit(qm.split_move(a1, a2, b1), qm.split_move(a2, a3, b3), |
58 | 63 | qm.split_move(b1, c1, c2)) |
59 | | - transformer.qubit_mapping(c) |
60 | | - device.validate_circuit(transformer.transform(c)) |
| 64 | + t = transformer(device) |
| 65 | + device.validate_circuit(t.transform(c)) |
61 | 66 |
|
62 | 67 |
|
| 68 | +@pytest.mark.parametrize('transformer', |
| 69 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 70 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
63 | 71 | @pytest.mark.parametrize('device', |
64 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
65 | | -def test_disconnected(device): |
66 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 72 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 73 | +def test_disconnected(transformer, device): |
67 | 74 | c = cirq.Circuit(qm.split_move(a1, a2, a3), qm.split_move(a3, a4, d1), |
68 | 75 | qm.split_move(b1, b2, b3), qm.split_move(c1, c2, c3)) |
69 | | - transformer.qubit_mapping(c) |
70 | | - device.validate_circuit(transformer.transform(c)) |
| 76 | + t = transformer(device) |
| 77 | + device.validate_circuit(t.transform(c)) |
71 | 78 |
|
72 | 79 |
|
| 80 | +@pytest.mark.parametrize('transformer', |
| 81 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 82 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
73 | 83 | @pytest.mark.parametrize('device', |
74 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
75 | | -def test_move_around_square(device): |
76 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 84 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 85 | +def test_move_around_square(transformer, device): |
77 | 86 | c = cirq.Circuit(qm.normal_move(a1, a2), qm.normal_move(a2, b2), |
78 | 87 | qm.normal_move(b2, b1), qm.normal_move(b1, a1)) |
79 | | - transformer.qubit_mapping(c) |
80 | | - device.validate_circuit(transformer.transform(c)) |
| 88 | + t = transformer(device) |
| 89 | + device.validate_circuit(t.transform(c)) |
81 | 90 |
|
82 | 91 |
|
| 92 | +@pytest.mark.parametrize('transformer', |
| 93 | + [ct.ConnectivityHeuristicCircuitTransformer, |
| 94 | + ct.DynamicLookAheadHeuristicCircuitTransformer]) |
83 | 95 | @pytest.mark.parametrize('device', |
84 | | - (cirq.google.Sycamore23, cirq.google.Sycamore)) |
85 | | -def test_split_then_merge(device): |
86 | | - transformer = ct.ConnectivityHeuristicCircuitTransformer(device) |
| 96 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 97 | +def test_split_then_merge(transformer, device): |
87 | 98 | c = cirq.Circuit(qm.split_move(a1, a2, b1), qm.split_move(a2, a3, b3), |
88 | 99 | qm.split_move(b1, c1, c2), qm.normal_move(c1, d1), |
89 | 100 | qm.normal_move(a3, a4), qm.merge_move(a4, d1, a1)) |
90 | | - transformer.qubit_mapping(c) |
91 | | - device.validate_circuit(transformer.transform(c)) |
| 101 | + t = transformer(device) |
| 102 | + device.validate_circuit(t.transform(c)) |
| 103 | + |
| 104 | + |
| 105 | +@pytest.mark.parametrize('device', |
| 106 | + [cirq.google.Sycamore23, cirq.google.Sycamore]) |
| 107 | +def test_split_then_merge_trapezoid(device): |
| 108 | + c = cirq.Circuit(qm.split_move(a1, a2, b1), qm.normal_move(a2, a3), |
| 109 | + qm.merge_move(a3, b1, b3)) |
| 110 | + t = ct.DynamicLookAheadHeuristicCircuitTransformer(device) |
| 111 | + device.validate_circuit(t.transform(c)) |
0 commit comments