@@ -105,8 +105,8 @@ def test_aqt_sampler_error_handling():
105
105
max_angle = np .pi
106
106
repetitions = 10
107
107
sampler = AQTSampler (remote_host = "http://localhost:5000" , access_token = 'testkey' )
108
- device , qubits = get_aqt_device (1 )
109
- circuit = cirq .Circuit (cirq .X (qubits [0 ]) ** theta , device = device )
108
+ _ , qubits = get_aqt_device (1 )
109
+ circuit = cirq .Circuit (cirq .X (qubits [0 ]) ** theta )
110
110
sweep = cirq .Linspace (key = 'theta' , start = 0.1 , stop = max_angle / np .pi , length = num_points )
111
111
with pytest .raises (RuntimeError ):
112
112
_results = sampler .run_sweep (circuit , params = sweep , repetitions = repetitions )
@@ -117,10 +117,10 @@ def test_aqt_sampler_empty_circuit():
117
117
max_angle = np .pi
118
118
repetitions = 1000
119
119
num_qubits = 4
120
- device , _qubits = get_aqt_device (num_qubits )
120
+ _ , _qubits = get_aqt_device (num_qubits )
121
121
sampler = AQTSamplerLocalSimulator ()
122
122
sampler .simulate_ideal = True
123
- circuit = cirq .Circuit (device = device )
123
+ circuit = cirq .Circuit ()
124
124
sweep = cirq .Linspace (key = 'theta' , start = 0.1 , stop = max_angle / np .pi , length = num_points )
125
125
with pytest .raises (RuntimeError ):
126
126
_results = sampler .run_sweep (circuit , params = sweep , repetitions = repetitions )
@@ -141,8 +141,8 @@ def test_aqt_sampler():
141
141
max_angle = np .pi
142
142
repetitions = 10
143
143
sampler = AQTSampler (remote_host = "http://localhost:5000" , access_token = 'testkey' )
144
- device , qubits = get_aqt_device (1 )
145
- circuit = cirq .Circuit (cirq .X (qubits [0 ]) ** theta , device = device )
144
+ _ , qubits = get_aqt_device (1 )
145
+ circuit = cirq .Circuit (cirq .X (qubits [0 ]) ** theta )
146
146
sweep = cirq .Linspace (key = 'theta' , start = 0.1 , stop = max_angle / np .pi , length = num_points )
147
147
results = sampler .run_sweep (circuit , params = sweep , repetitions = repetitions )
148
148
excited_state_probs = np .zeros (num_points )
@@ -160,10 +160,18 @@ def test_aqt_sampler_sim():
160
160
max_angle = np .pi
161
161
repetitions = 1000
162
162
num_qubits = 4
163
- device , qubits = get_aqt_device (num_qubits )
163
+ _ , qubits = get_aqt_device (num_qubits )
164
164
sampler = AQTSamplerLocalSimulator ()
165
165
sampler .simulate_ideal = True
166
- circuit = cirq .Circuit (cirq .X (qubits [3 ]) ** theta , device = device )
166
+ circuit = cirq .Circuit (
167
+ cirq .X (qubits [3 ]) ** theta ,
168
+ cirq .X (qubits [0 ]),
169
+ cirq .X (qubits [0 ]),
170
+ cirq .X (qubits [1 ]),
171
+ cirq .X (qubits [1 ]),
172
+ cirq .X (qubits [2 ]),
173
+ cirq .X (qubits [2 ]),
174
+ )
167
175
circuit .append (cirq .PhasedXPowGate (phase_exponent = 0.5 , exponent = - 0.5 ).on (qubits [0 ]))
168
176
circuit .append (cirq .PhasedXPowGate (phase_exponent = 0.5 , exponent = 0.5 ).on (qubits [0 ]))
169
177
sweep = cirq .Linspace (key = 'theta' , start = 0.1 , stop = max_angle / np .pi , length = num_points )
@@ -179,20 +187,26 @@ def test_aqt_sampler_sim_xtalk():
179
187
max_angle = np .pi
180
188
repetitions = 100
181
189
num_qubits = 4
182
- device , qubits = get_aqt_device (num_qubits )
190
+ _ , qubits = get_aqt_device (num_qubits )
183
191
sampler = AQTSamplerLocalSimulator ()
184
192
sampler .simulate_ideal = False
185
- circuit = cirq .Circuit (cirq .X (qubits [0 ]), cirq .X (qubits [3 ]), cirq .X (qubits [2 ]), device = device )
193
+ circuit = cirq .Circuit (
194
+ cirq .X (qubits [0 ]),
195
+ cirq .X (qubits [1 ]),
196
+ cirq .X (qubits [1 ]),
197
+ cirq .X (qubits [3 ]),
198
+ cirq .X (qubits [2 ]),
199
+ )
186
200
sweep = cirq .Linspace (key = 'theta' , start = 0.1 , stop = max_angle / np .pi , length = num_points )
187
201
_results = sampler .run_sweep (circuit , params = sweep , repetitions = repetitions )
188
202
189
203
190
204
def test_aqt_sampler_ms ():
191
205
repetitions = 1000
192
206
num_qubits = 4
193
- device , qubits = get_aqt_device (num_qubits )
207
+ _ , qubits = get_aqt_device (num_qubits )
194
208
sampler = AQTSamplerLocalSimulator ()
195
- circuit = cirq .Circuit (device = device )
209
+ circuit = cirq .Circuit (cirq . Z . on_each ( * qubits ), cirq . Z . on_each ( * qubits ) )
196
210
for _dummy in range (9 ):
197
211
circuit .append (cirq .XX (qubits [0 ], qubits [1 ]) ** 0.5 )
198
212
circuit .append (cirq .Z (qubits [0 ]) ** 0.5 )
0 commit comments