cirq-core 1.3.0.dev20231201141002__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cirq/__init__.py +4 -0
- cirq/_compat.py +9 -11
- cirq/_compat_test.py +45 -56
- cirq/_version.py +31 -1
- cirq/_version_test.py +1 -1
- cirq/circuits/circuit.py +13 -8
- cirq/circuits/circuit_operation.py +2 -1
- cirq/circuits/circuit_test.py +2 -2
- cirq/circuits/frozen_circuit.py +3 -2
- cirq/circuits/moment.py +12 -10
- cirq/circuits/qasm_output.py +5 -1
- cirq/circuits/qasm_output_test.py +25 -10
- cirq/contrib/qcircuit/qcircuit_diagram_info.py +9 -7
- cirq/contrib/quimb/mps_simulator_test.py +1 -1
- cirq/contrib/quimb/state_vector.py +9 -2
- cirq/contrib/svg/svg.py +2 -1
- cirq/contrib/svg/svg_test.py +1 -0
- cirq/devices/grid_qubit.py +85 -32
- cirq/devices/grid_qubit_test.py +22 -4
- cirq/devices/line_qubit.py +74 -26
- cirq/devices/line_qubit_test.py +19 -0
- cirq/devices/noise_utils.py +33 -31
- cirq/devices/noise_utils_test.py +1 -84
- cirq/devices/superconducting_qubits_noise_properties.py +7 -6
- cirq/experiments/__init__.py +8 -0
- cirq/experiments/qubit_characterizations.py +288 -44
- cirq/experiments/qubit_characterizations_test.py +61 -7
- cirq/experiments/random_quantum_circuit_generation.py +1 -1
- cirq/experiments/single_qubit_readout_calibration.py +132 -6
- cirq/experiments/single_qubit_readout_calibration_test.py +3 -1
- cirq/experiments/t1_decay_experiment.py +14 -7
- cirq/experiments/t1_decay_experiment_test.py +14 -26
- cirq/experiments/two_qubit_xeb.py +483 -0
- cirq/experiments/two_qubit_xeb_test.py +304 -0
- cirq/json_resolver_cache.py +2 -0
- cirq/linalg/decompositions.py +11 -13
- cirq/linalg/decompositions_test.py +1 -3
- cirq/linalg/diagonalize.py +5 -4
- cirq/linalg/predicates.py +8 -6
- cirq/linalg/transformations.py +2 -1
- cirq/linalg/transformations_test.py +1 -1
- cirq/ops/__init__.py +2 -0
- cirq/ops/clifford_gate.py +59 -16
- cirq/ops/common_gates_test.py +1 -2
- cirq/ops/control_values.py +4 -3
- cirq/ops/controlled_gate_test.py +1 -3
- cirq/ops/gate_operation.py +10 -1
- cirq/ops/named_qubit.py +74 -28
- cirq/ops/named_qubit_test.py +19 -0
- cirq/ops/parity_gates.py +5 -0
- cirq/ops/parity_gates_test.py +2 -10
- cirq/ops/pauli_gates.py +5 -2
- cirq/ops/pauli_string.py +2 -2
- cirq/ops/permutation_gate.py +16 -18
- cirq/ops/phased_iswap_gate_test.py +1 -3
- cirq/ops/phased_x_gate.py +1 -1
- cirq/ops/phased_x_z_gate.py +17 -1
- cirq/ops/phased_x_z_gate_test.py +24 -0
- cirq/ops/qid_util.py +4 -8
- cirq/ops/qubit_manager.py +7 -4
- cirq/ops/qubit_manager_test.py +20 -0
- cirq/ops/raw_types.py +5 -2
- cirq/ops/raw_types_test.py +14 -15
- cirq/ops/uniform_superposition_gate.py +123 -0
- cirq/ops/uniform_superposition_gate_test.py +94 -0
- cirq/protocols/approximate_equality_protocol_test.py +2 -2
- cirq/protocols/circuit_diagram_info_protocol.py +6 -4
- cirq/protocols/commutes_protocol.py +2 -4
- cirq/protocols/decompose_protocol.py +7 -12
- cirq/protocols/decompose_protocol_test.py +7 -3
- cirq/protocols/has_stabilizer_effect_protocol.py +1 -5
- cirq/protocols/has_stabilizer_effect_protocol_test.py +13 -4
- cirq/protocols/json_serialization.py +51 -181
- cirq/protocols/json_serialization_test.py +13 -47
- cirq/protocols/json_test_data/CircuitOperation.json +131 -148
- cirq/protocols/json_test_data/CircuitOperation.json_inward +55 -0
- cirq/protocols/json_test_data/CircuitOperation.repr_inward +6 -0
- cirq/protocols/json_test_data/FrozenCircuit.json +196 -210
- cirq/protocols/json_test_data/FrozenCircuit.json_inward +35 -0
- cirq/protocols/json_test_data/FrozenCircuit.repr_inward +4 -0
- cirq/protocols/json_test_data/UniformSuperpositionGate.json +5 -0
- cirq/protocols/json_test_data/UniformSuperpositionGate.repr +1 -0
- cirq/protocols/json_test_data/cirq.MSGate.json +4 -0
- cirq/protocols/json_test_data/cirq.MSGate.repr +1 -0
- cirq/protocols/json_test_data/spec.py +2 -0
- cirq/protocols/pow_protocol_test.py +1 -3
- cirq/protocols/resolve_parameters.py +4 -2
- cirq/qis/__init__.py +10 -0
- cirq/qis/clifford_tableau.py +8 -2
- cirq/qis/noise_utils.py +123 -0
- cirq/qis/noise_utils_test.py +97 -0
- cirq/sim/classical_simulator.py +227 -87
- cirq/sim/classical_simulator_test.py +135 -0
- cirq/sim/clifford/clifford_simulator_test.py +4 -2
- cirq/sim/mux.py +5 -3
- cirq/sim/simulation_product_state.py +15 -10
- cirq/sim/simulation_state.py +1 -1
- cirq/sim/simulation_state_test.py +2 -2
- cirq/sim/simulator_base.py +3 -3
- cirq/sim/state_vector_simulation_state.py +4 -4
- cirq/sim/state_vector_simulator.py +17 -2
- cirq/study/__init__.py +1 -0
- cirq/study/result.py +14 -0
- cirq/study/result_test.py +6 -0
- cirq/study/sweeps.py +4 -2
- cirq/study/sweeps_test.py +8 -0
- cirq/testing/__init__.py +6 -1
- cirq/testing/_compat_test_data/__init__.py +3 -3
- cirq/testing/_compat_test_data/module_a/__init__.py +2 -2
- cirq/testing/circuit_compare.py +1 -1
- cirq/testing/consistent_qasm.py +6 -0
- cirq/testing/gate_features.py +10 -0
- cirq/testing/lin_alg_utils.py +5 -3
- cirq/transformers/__init__.py +15 -0
- cirq/transformers/analytical_decompositions/controlled_gate_decomposition.py +3 -1
- cirq/transformers/analytical_decompositions/two_qubit_to_cz.py +24 -0
- cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py +17 -0
- cirq/transformers/dynamical_decoupling.py +122 -0
- cirq/transformers/dynamical_decoupling_test.py +123 -0
- cirq/transformers/gauge_compiling/__init__.py +26 -0
- cirq/transformers/gauge_compiling/cz_gauge.py +46 -0
- cirq/transformers/gauge_compiling/cz_gauge_test.py +23 -0
- cirq/transformers/gauge_compiling/gauge_compiling.py +214 -0
- cirq/transformers/gauge_compiling/gauge_compiling_test.py +41 -0
- cirq/transformers/gauge_compiling/gauge_compiling_test_utils.py +83 -0
- cirq/transformers/gauge_compiling/gauge_compiling_test_utils_test.py +52 -0
- cirq/transformers/gauge_compiling/iswap_gauge.py +105 -0
- cirq/transformers/gauge_compiling/iswap_gauge_test.py +23 -0
- cirq/transformers/gauge_compiling/spin_inversion_gauge.py +33 -0
- cirq/transformers/gauge_compiling/spin_inversion_gauge_test.py +37 -0
- cirq/transformers/gauge_compiling/sqrt_cz_gauge.py +64 -0
- cirq/transformers/gauge_compiling/sqrt_cz_gauge_test.py +27 -0
- cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py +94 -0
- cirq/transformers/gauge_compiling/sqrt_iswap_gauge_test.py +22 -0
- cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation.py +1 -0
- cirq/transformers/merge_k_qubit_gates_test.py +23 -23
- cirq/transformers/merge_single_qubit_gates_test.py +14 -14
- cirq/transformers/optimize_for_target_gateset.py +39 -17
- cirq/transformers/optimize_for_target_gateset_test.py +189 -39
- cirq/transformers/qubit_management_transformers.py +1 -1
- cirq/transformers/routing/visualize_routed_circuit_test.py +17 -17
- cirq/transformers/stratify_test.py +13 -13
- cirq/transformers/target_gatesets/compilation_target_gateset.py +26 -2
- cirq/transformers/target_gatesets/compilation_target_gateset_test.py +16 -16
- cirq/transformers/target_gatesets/cz_gateset.py +4 -0
- cirq/transformers/transformer_api.py +1 -2
- cirq/transformers/transformer_primitives.py +15 -14
- cirq/transformers/transformer_primitives_test.py +99 -72
- cirq/value/classical_data.py +6 -6
- cirq/value/value_equality_attr.py +4 -0
- cirq/work/sampler.py +3 -4
- cirq/work/sampler_test.py +25 -0
- {cirq_core-1.3.0.dev20231201141002.dist-info → cirq_core-1.4.0.dist-info}/METADATA +10 -19
- {cirq_core-1.3.0.dev20231201141002.dist-info → cirq_core-1.4.0.dist-info}/RECORD +157 -130
- {cirq_core-1.3.0.dev20231201141002.dist-info → cirq_core-1.4.0.dist-info}/WHEEL +1 -1
- {cirq_core-1.3.0.dev20231201141002.dist-info → cirq_core-1.4.0.dist-info}/LICENSE +0 -0
- {cirq_core-1.3.0.dev20231201141002.dist-info → cirq_core-1.4.0.dist-info}/top_level.txt +0 -0
|
@@ -1,222 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"cirq_type": "VAL",
|
|
4
|
+
"key": 0,
|
|
5
|
+
"val": {
|
|
6
|
+
"cirq_type": "FrozenCircuit",
|
|
7
|
+
"moments": [
|
|
8
|
+
{
|
|
9
|
+
"cirq_type": "Moment",
|
|
10
|
+
"operations": [
|
|
11
|
+
{
|
|
12
|
+
"cirq_type": "GateOperation",
|
|
13
|
+
"gate": {
|
|
14
|
+
"cirq_type": "HPowGate",
|
|
14
15
|
"exponent": 1.0,
|
|
15
16
|
"global_shift": 0.0
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
"qubits": [
|
|
19
|
+
{
|
|
20
|
+
"cirq_type": "LineQubit",
|
|
21
|
+
"x": 0
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"cirq_type": "GateOperation",
|
|
27
|
+
"gate": {
|
|
28
|
+
"cirq_type": "HPowGate",
|
|
29
|
+
"exponent": 1.0,
|
|
30
|
+
"global_shift": 0.0
|
|
23
31
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
"qubits": [
|
|
33
|
+
{
|
|
34
|
+
"cirq_type": "LineQubit",
|
|
35
|
+
"x": 1
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"cirq_type": "GateOperation",
|
|
41
|
+
"gate": {
|
|
42
|
+
"cirq_type": "HPowGate",
|
|
43
|
+
"exponent": 1.0,
|
|
44
|
+
"global_shift": 0.0
|
|
37
45
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
"qubits": [
|
|
47
|
+
{
|
|
48
|
+
"cirq_type": "LineQubit",
|
|
49
|
+
"x": 2
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"cirq_type": "GateOperation",
|
|
55
|
+
"gate": {
|
|
56
|
+
"cirq_type": "HPowGate",
|
|
57
|
+
"exponent": 1.0,
|
|
58
|
+
"global_shift": 0.0
|
|
51
59
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
"qubits": [
|
|
61
|
+
{
|
|
62
|
+
"cirq_type": "LineQubit",
|
|
63
|
+
"x": 3
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"cirq_type": "GateOperation",
|
|
69
|
+
"gate": {
|
|
70
|
+
"cirq_type": "HPowGate",
|
|
71
|
+
"exponent": 1.0,
|
|
72
|
+
"global_shift": 0.0
|
|
65
73
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
"qubits": [
|
|
75
|
+
{
|
|
76
|
+
"cirq_type": "LineQubit",
|
|
77
|
+
"x": 4
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"cirq_type": "Moment",
|
|
85
|
+
"operations": [
|
|
86
|
+
{
|
|
87
|
+
"cirq_type": "GateOperation",
|
|
88
|
+
"gate": {
|
|
89
|
+
"cirq_type": "MeasurementGate",
|
|
90
|
+
"num_qubits": 5,
|
|
91
|
+
"key": "0,1,2,3,4",
|
|
92
|
+
"invert_mask": []
|
|
93
|
+
},
|
|
94
|
+
"qubits": [
|
|
95
|
+
{
|
|
96
|
+
"cirq_type": "LineQubit",
|
|
97
|
+
"x": 0
|
|
72
98
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"x": 4
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"cirq_type": "Moment",
|
|
84
|
-
"operations": [
|
|
85
|
-
{
|
|
86
|
-
"cirq_type": "GateOperation",
|
|
87
|
-
"gate": {
|
|
88
|
-
"cirq_type": "MeasurementGate",
|
|
89
|
-
"num_qubits": 5,
|
|
90
|
-
"key": "0,1,2,3,4",
|
|
91
|
-
"invert_mask": []
|
|
99
|
+
{
|
|
100
|
+
"cirq_type": "LineQubit",
|
|
101
|
+
"x": 1
|
|
92
102
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"x": 0
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"cirq_type": "LineQubit",
|
|
100
|
-
"x": 1
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"cirq_type": "LineQubit",
|
|
104
|
-
"x": 2
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"cirq_type": "LineQubit",
|
|
108
|
-
"x": 3
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"cirq_type": "LineQubit",
|
|
112
|
-
"x": 4
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"cirq_type": "_SerializedContext",
|
|
123
|
-
"key": 2,
|
|
124
|
-
"obj": {
|
|
125
|
-
"cirq_type": "FrozenCircuit",
|
|
126
|
-
"moments": [
|
|
127
|
-
{
|
|
128
|
-
"cirq_type": "Moment",
|
|
129
|
-
"operations": [
|
|
130
|
-
{
|
|
131
|
-
"cirq_type": "GateOperation",
|
|
132
|
-
"gate": {
|
|
133
|
-
"cirq_type": "CCXPowGate",
|
|
134
|
-
"exponent": 1.0,
|
|
135
|
-
"global_shift": 0.0
|
|
103
|
+
{
|
|
104
|
+
"cirq_type": "LineQubit",
|
|
105
|
+
"x": 2
|
|
136
106
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
"x": 0
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"cirq_type": "LineQubit",
|
|
144
|
-
"x": 1
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"cirq_type": "LineQubit",
|
|
148
|
-
"x": 2
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"cirq_type": "Moment",
|
|
156
|
-
"operations": [
|
|
157
|
-
{
|
|
158
|
-
"cirq_type": "GateOperation",
|
|
159
|
-
"gate": {
|
|
160
|
-
"cirq_type": "XPowGate",
|
|
161
|
-
"exponent": 0.123,
|
|
162
|
-
"global_shift": 0.0
|
|
107
|
+
{
|
|
108
|
+
"cirq_type": "LineQubit",
|
|
109
|
+
"x": 3
|
|
163
110
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
"
|
|
111
|
+
{
|
|
112
|
+
"cirq_type": "LineQubit",
|
|
113
|
+
"x": 4
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"cirq_type": "VAL",
|
|
124
|
+
"key": 1,
|
|
125
|
+
"val": {
|
|
126
|
+
"cirq_type": "FrozenCircuit",
|
|
127
|
+
"moments": [
|
|
128
|
+
{
|
|
129
|
+
"cirq_type": "Moment",
|
|
130
|
+
"operations": [
|
|
131
|
+
{
|
|
132
|
+
"cirq_type": "GateOperation",
|
|
133
|
+
"gate": {
|
|
134
|
+
"cirq_type": "CCXPowGate",
|
|
135
|
+
"exponent": 1.0,
|
|
136
|
+
"global_shift": 0.0
|
|
137
|
+
},
|
|
138
|
+
"qubits": [
|
|
139
|
+
{
|
|
140
|
+
"cirq_type": "LineQubit",
|
|
141
|
+
"x": 0
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"cirq_type": "LineQubit",
|
|
145
|
+
"x": 1
|
|
194
146
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
147
|
+
{
|
|
148
|
+
"cirq_type": "LineQubit",
|
|
149
|
+
"x": 2
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"cirq_type": "Moment",
|
|
157
|
+
"operations": [
|
|
158
|
+
{
|
|
159
|
+
"cirq_type": "GateOperation",
|
|
160
|
+
"gate": {
|
|
161
|
+
"cirq_type": "XPowGate",
|
|
162
|
+
"exponent": 0.123,
|
|
163
|
+
"global_shift": 0.0
|
|
164
|
+
},
|
|
165
|
+
"qubits": [
|
|
166
|
+
{
|
|
167
|
+
"cirq_type": "LineQubit",
|
|
168
|
+
"x": 0
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"cirq_type": "VAL",
|
|
179
|
+
"key": 2,
|
|
180
|
+
"val": {
|
|
181
|
+
"cirq_type": "FrozenCircuit",
|
|
182
|
+
"moments": [
|
|
183
|
+
{
|
|
184
|
+
"cirq_type": "Moment",
|
|
185
|
+
"operations": [
|
|
186
|
+
{
|
|
187
|
+
"cirq_type": "GateOperation",
|
|
188
|
+
"gate": {
|
|
189
|
+
"cirq_type": "XPowGate",
|
|
190
|
+
"exponent": {
|
|
191
|
+
"cirq_type": "sympy.Symbol",
|
|
192
|
+
"name": "theta"
|
|
193
|
+
},
|
|
194
|
+
"global_shift": 0.0
|
|
195
|
+
},
|
|
196
|
+
"qubits": [
|
|
197
|
+
{
|
|
198
|
+
"cirq_type": "LineQubit",
|
|
199
|
+
"x": 0
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
@@ -213,6 +213,37 @@
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
|
+
{
|
|
217
|
+
"cirq_type": "_SerializedContext",
|
|
218
|
+
"key": 4,
|
|
219
|
+
"obj": {
|
|
220
|
+
"cirq_type": "FrozenCircuit",
|
|
221
|
+
"moments": [
|
|
222
|
+
{
|
|
223
|
+
"cirq_type": "Moment",
|
|
224
|
+
"operations": [
|
|
225
|
+
{
|
|
226
|
+
"cirq_type": "GateOperation",
|
|
227
|
+
"gate": {
|
|
228
|
+
"cirq_type": "XPowGate",
|
|
229
|
+
"exponent": {
|
|
230
|
+
"cirq_type": "sympy.Symbol",
|
|
231
|
+
"name": "theta"
|
|
232
|
+
},
|
|
233
|
+
"global_shift": 0.0
|
|
234
|
+
},
|
|
235
|
+
"qubits": [
|
|
236
|
+
{
|
|
237
|
+
"cirq_type": "LineQubit",
|
|
238
|
+
"x": 0
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
},
|
|
216
247
|
[
|
|
217
248
|
{
|
|
218
249
|
"cirq_type": "_SerializedKey",
|
|
@@ -225,6 +256,10 @@
|
|
|
225
256
|
{
|
|
226
257
|
"cirq_type": "_SerializedKey",
|
|
227
258
|
"key": 3
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"cirq_type": "_SerializedKey",
|
|
262
|
+
"key": 4
|
|
228
263
|
}
|
|
229
264
|
]
|
|
230
265
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cirq.UniformSuperpositionGate(m_value=7, num_qubits=3)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cirq.ms(np.pi/2)
|
|
@@ -22,6 +22,7 @@ TestSpec = ModuleJsonTestSpec(
|
|
|
22
22
|
name="cirq",
|
|
23
23
|
packages=[cirq, cirq.work],
|
|
24
24
|
test_data_path=pathlib.Path(__file__).parent,
|
|
25
|
+
custom_class_name_to_cirq_type={"MSGate": "cirq.MSGate"},
|
|
25
26
|
resolver_cache=_class_resolver_dictionary(),
|
|
26
27
|
not_yet_serializable=[
|
|
27
28
|
'Alignment',
|
|
@@ -108,6 +109,7 @@ TestSpec = ModuleJsonTestSpec(
|
|
|
108
109
|
'StateVectorStepResult',
|
|
109
110
|
'StepResultBase',
|
|
110
111
|
'UnitSweep',
|
|
112
|
+
'UNIT_SWEEP',
|
|
111
113
|
'NamedTopology',
|
|
112
114
|
# protocols:
|
|
113
115
|
'HasJSONNamespace',
|
|
@@ -49,6 +49,4 @@ def test_pow_error():
|
|
|
49
49
|
|
|
50
50
|
@pytest.mark.parametrize('val,exponent,out', ((ReturnsExponent(), 2, 2), (1, 2, 1), (2, 3, 8)))
|
|
51
51
|
def test_pow_with_result(val, exponent, out):
|
|
52
|
-
assert (
|
|
53
|
-
cirq.pow(val, exponent) == cirq.pow(val, exponent, default=None) == val**exponent == out
|
|
54
|
-
)
|
|
52
|
+
assert cirq.pow(val, exponent) == cirq.pow(val, exponent, default=None) == val**exponent == out
|
|
@@ -178,8 +178,10 @@ def resolve_parameters(
|
|
|
178
178
|
if isinstance(val, (list, tuple)):
|
|
179
179
|
return cast(T, type(val)(resolve_parameters(e, param_resolver, recursive) for e in val))
|
|
180
180
|
|
|
181
|
-
is_parameterized =
|
|
182
|
-
|
|
181
|
+
is_parameterized = (
|
|
182
|
+
val._is_parameterized_() if hasattr(val, '_is_parameterized_') else NotImplemented
|
|
183
|
+
)
|
|
184
|
+
if is_parameterized is not NotImplemented and not is_parameterized:
|
|
183
185
|
return val
|
|
184
186
|
|
|
185
187
|
getter = getattr(val, '_resolve_parameters_', None)
|
cirq/qis/__init__.py
CHANGED
|
@@ -50,3 +50,13 @@ from cirq.qis.states import (
|
|
|
50
50
|
validate_qid_shape,
|
|
51
51
|
validate_normalized_state_vector,
|
|
52
52
|
)
|
|
53
|
+
|
|
54
|
+
from cirq.qis.noise_utils import (
|
|
55
|
+
decay_constant_to_xeb_fidelity,
|
|
56
|
+
decay_constant_to_pauli_error,
|
|
57
|
+
pauli_error_to_decay_constant,
|
|
58
|
+
xeb_fidelity_to_decay_constant,
|
|
59
|
+
pauli_error_from_t1,
|
|
60
|
+
average_error,
|
|
61
|
+
decoherence_pauli_error,
|
|
62
|
+
)
|
cirq/qis/clifford_tableau.py
CHANGED
|
@@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Sequence, TYPE_CHECKING
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
|
|
19
19
|
from cirq import protocols
|
|
20
|
-
from cirq._compat import proper_repr
|
|
20
|
+
from cirq._compat import proper_repr, cached_method
|
|
21
21
|
from cirq.qis import quantum_state_representation
|
|
22
22
|
from cirq.value import big_endian_int_to_digits, linear_dict, random_state
|
|
23
23
|
|
|
@@ -129,7 +129,9 @@ class StabilizerState(
|
|
|
129
129
|
|
|
130
130
|
class CliffordTableau(StabilizerState):
|
|
131
131
|
"""Tableau representation of a stabilizer state
|
|
132
|
-
|
|
132
|
+
|
|
133
|
+
References:
|
|
134
|
+
- [Aaronson and Gottesman](https://arxiv.org/abs/quant-ph/0406196)
|
|
133
135
|
|
|
134
136
|
The tableau stores the stabilizer generators of
|
|
135
137
|
the state using three binary arrays: xs, zs, and rs.
|
|
@@ -652,3 +654,7 @@ class CliffordTableau(StabilizerState):
|
|
|
652
654
|
self, axes: Sequence[int], seed: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None
|
|
653
655
|
) -> List[int]:
|
|
654
656
|
return [self._measure(axis, random_state.parse_random_state(seed)) for axis in axes]
|
|
657
|
+
|
|
658
|
+
@cached_method
|
|
659
|
+
def __hash__(self) -> int:
|
|
660
|
+
return hash(self.matrix().tobytes() + self.rs.tobytes())
|