cirq-core 1.5.0.dev20241014205813__py3-none-any.whl → 1.5.0.dev20241014220150__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.
Potentially problematic release.
This version of cirq-core might be problematic. Click here for more details.
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/experiments/xeb_fitting_test.py +24 -20
- cirq/experiments/xeb_simulation_test.py +16 -13
- {cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/METADATA +1 -1
- {cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/RECORD +9 -9
- {cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/WHEEL +0 -0
- {cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import itertools
|
|
16
18
|
import multiprocessing
|
|
17
|
-
from typing import Iterable
|
|
19
|
+
from typing import Iterable, Iterator
|
|
18
20
|
|
|
19
21
|
import networkx as nx
|
|
20
22
|
import numpy as np
|
|
@@ -40,6 +42,13 @@ from cirq.experiments.xeb_sampling import sample_2q_xeb_circuits
|
|
|
40
42
|
_POOL_NUM_PROCESSES = min(4, multiprocessing.cpu_count())
|
|
41
43
|
|
|
42
44
|
|
|
45
|
+
@pytest.fixture
|
|
46
|
+
def pool() -> Iterator[multiprocessing.pool.Pool]:
|
|
47
|
+
ctx = multiprocessing.get_context()
|
|
48
|
+
with ctx.Pool(_POOL_NUM_PROCESSES) as pool:
|
|
49
|
+
yield pool
|
|
50
|
+
|
|
51
|
+
|
|
43
52
|
@pytest.fixture(scope='module')
|
|
44
53
|
def circuits_cycle_depths_sampled_df():
|
|
45
54
|
q0, q1 = cirq.LineQubit.range(2)
|
|
@@ -207,7 +216,7 @@ def test_get_initial_simplex():
|
|
|
207
216
|
assert simplex.shape[1] == len(names)
|
|
208
217
|
|
|
209
218
|
|
|
210
|
-
def test_characterize_phased_fsim_parameters_with_xeb():
|
|
219
|
+
def test_characterize_phased_fsim_parameters_with_xeb(pool):
|
|
211
220
|
q0, q1 = cirq.LineQubit.range(2)
|
|
212
221
|
rs = np.random.RandomState(52)
|
|
213
222
|
circuits = [
|
|
@@ -232,17 +241,16 @@ def test_characterize_phased_fsim_parameters_with_xeb():
|
|
|
232
241
|
characterize_phi=False,
|
|
233
242
|
)
|
|
234
243
|
p_circuits = [parameterize_circuit(circuit, options) for circuit in circuits]
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
244
|
+
result = characterize_phased_fsim_parameters_with_xeb(
|
|
245
|
+
sampled_df=sampled_df,
|
|
246
|
+
parameterized_circuits=p_circuits,
|
|
247
|
+
cycle_depths=cycle_depths,
|
|
248
|
+
options=options,
|
|
249
|
+
# speed up with looser tolerances:
|
|
250
|
+
fatol=1e-2,
|
|
251
|
+
xatol=1e-2,
|
|
252
|
+
pool=pool,
|
|
253
|
+
)
|
|
246
254
|
opt_res = result.optimization_results[(q0, q1)]
|
|
247
255
|
assert np.abs(opt_res.x[0] + np.pi / 4) < 0.1
|
|
248
256
|
assert np.abs(opt_res.fun) < 0.1 # noiseless simulator
|
|
@@ -252,7 +260,7 @@ def test_characterize_phased_fsim_parameters_with_xeb():
|
|
|
252
260
|
|
|
253
261
|
|
|
254
262
|
@pytest.mark.parametrize('use_pool', (True, False))
|
|
255
|
-
def test_parallel_full_workflow(use_pool):
|
|
263
|
+
def test_parallel_full_workflow(request, use_pool):
|
|
256
264
|
circuits = rqcg.generate_library_of_2q_circuits(
|
|
257
265
|
n_library_circuits=5,
|
|
258
266
|
two_qubit_gate=cirq.ISWAP**0.5,
|
|
@@ -272,10 +280,8 @@ def test_parallel_full_workflow(use_pool):
|
|
|
272
280
|
combinations_by_layer=combs,
|
|
273
281
|
)
|
|
274
282
|
|
|
275
|
-
if
|
|
276
|
-
|
|
277
|
-
else:
|
|
278
|
-
pool = None
|
|
283
|
+
# avoid starting worker pool if it is not needed
|
|
284
|
+
pool = request.getfixturevalue("pool") if use_pool else None
|
|
279
285
|
|
|
280
286
|
fids_df_0 = benchmark_2q_xeb_fidelities(
|
|
281
287
|
sampled_df=sampled_df, circuits=circuits, cycle_depths=cycle_depths, pool=pool
|
|
@@ -296,8 +302,6 @@ def test_parallel_full_workflow(use_pool):
|
|
|
296
302
|
xatol=5e-2,
|
|
297
303
|
pool=pool,
|
|
298
304
|
)
|
|
299
|
-
if pool is not None:
|
|
300
|
-
pool.terminate()
|
|
301
305
|
|
|
302
306
|
assert len(result.optimization_results) == graph.number_of_edges()
|
|
303
307
|
for opt_res in result.optimization_results.values():
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import multiprocessing
|
|
16
|
-
from typing import Dict,
|
|
17
|
-
from typing import Sequence
|
|
18
|
+
from typing import Any, Dict, Iterator, Optional, Sequence
|
|
18
19
|
|
|
19
20
|
import numpy as np
|
|
20
21
|
import pandas as pd
|
|
@@ -27,7 +28,14 @@ from cirq.experiments.xeb_simulation import simulate_2q_xeb_circuits
|
|
|
27
28
|
_POOL_NUM_PROCESSES = min(4, multiprocessing.cpu_count())
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
@pytest.fixture
|
|
32
|
+
def pool() -> Iterator[multiprocessing.pool.Pool]:
|
|
33
|
+
ctx = multiprocessing.get_context()
|
|
34
|
+
with ctx.Pool(_POOL_NUM_PROCESSES) as pool:
|
|
35
|
+
yield pool
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_simulate_2q_xeb_circuits(pool):
|
|
31
39
|
q0, q1 = cirq.LineQubit.range(2)
|
|
32
40
|
circuits = [
|
|
33
41
|
rqcg.random_rotations_between_two_qubit_circuit(
|
|
@@ -45,8 +53,7 @@ def test_simulate_2q_xeb_circuits():
|
|
|
45
53
|
assert len(row['pure_probs']) == 4
|
|
46
54
|
assert np.isclose(np.sum(row['pure_probs']), 1)
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
df2 = simulate_2q_xeb_circuits(circuits, cycle_depths, pool=pool)
|
|
56
|
+
df2 = simulate_2q_xeb_circuits(circuits, cycle_depths, pool=pool)
|
|
50
57
|
|
|
51
58
|
pd.testing.assert_frame_equal(df, df2)
|
|
52
59
|
|
|
@@ -121,8 +128,8 @@ def _ref_simulate_2q_xeb_circuits(
|
|
|
121
128
|
return pd.DataFrame(records).set_index(['circuit_i', 'cycle_depth']).sort_index()
|
|
122
129
|
|
|
123
130
|
|
|
124
|
-
@pytest.mark.parametrize('
|
|
125
|
-
def test_incremental_simulate(
|
|
131
|
+
@pytest.mark.parametrize('use_pool', (True, False))
|
|
132
|
+
def test_incremental_simulate(request, use_pool):
|
|
126
133
|
q0, q1 = cirq.LineQubit.range(2)
|
|
127
134
|
circuits = [
|
|
128
135
|
rqcg.random_rotations_between_two_qubit_circuit(
|
|
@@ -132,16 +139,12 @@ def test_incremental_simulate(multiprocess):
|
|
|
132
139
|
]
|
|
133
140
|
cycle_depths = np.arange(3, 100, 9, dtype=np.int64)
|
|
134
141
|
|
|
135
|
-
if
|
|
136
|
-
|
|
137
|
-
else:
|
|
138
|
-
pool = None
|
|
142
|
+
# avoid starting worker pool if it is not needed
|
|
143
|
+
pool = request.getfixturevalue("pool") if use_pool else None
|
|
139
144
|
|
|
140
145
|
df_ref = _ref_simulate_2q_xeb_circuits(circuits=circuits, cycle_depths=cycle_depths, pool=pool)
|
|
141
146
|
|
|
142
147
|
df = simulate_2q_xeb_circuits(circuits=circuits, cycle_depths=cycle_depths, pool=pool)
|
|
143
|
-
if pool is not None:
|
|
144
|
-
pool.terminate()
|
|
145
148
|
pd.testing.assert_frame_equal(df_ref, df)
|
|
146
149
|
|
|
147
150
|
# Use below for approximate equality, if e.g. you're using qsim:
|
{cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.5.0.
|
|
3
|
+
Version: 1.5.0.dev20241014220150
|
|
4
4
|
Summary: A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
|
|
5
5
|
Home-page: http://github.com/quantumlib/cirq
|
|
6
6
|
Author: The Cirq Developers
|
{cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/RECORD
RENAMED
|
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=Qq3ZcfgD-Nb81cEppQdJqhAyrVqXKtfXZYGXT0p-Wh0,34718
|
|
|
4
4
|
cirq/_doc.py,sha256=yDyWUD_2JDS0gShfGRb-rdqRt9-WeL7DhkqX7np0Nko,2879
|
|
5
5
|
cirq/_import.py,sha256=p9gMHJscbtDDkfHOaulvd3Aer0pwUF5AXpL89XR8dNw,8402
|
|
6
6
|
cirq/_import_test.py,sha256=6K_v0riZJXOXUphHNkGA8MY-JcmGlezFaGmvrNhm3OQ,1015
|
|
7
|
-
cirq/_version.py,sha256=
|
|
8
|
-
cirq/_version_test.py,sha256=
|
|
7
|
+
cirq/_version.py,sha256=FGiLPyP6iYNYcGGSBwLuokNhvYveal4dTZjTc-eFGuE,1206
|
|
8
|
+
cirq/_version_test.py,sha256=keXg_luj8qAz_2EMQTzuXnrLsAcPBrvyOYqo8LTE8OA,147
|
|
9
9
|
cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=ytePZtNZgKjOF2NiVpUTuotB-JKZmQNOFIFdvXqsxHw,13271
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -199,11 +199,11 @@ cirq/experiments/t2_decay_experiment_test.py,sha256=DFR0BGn0Id4qNPfqIExj70TEAqf7
|
|
|
199
199
|
cirq/experiments/two_qubit_xeb.py,sha256=N2X9N1A6hRS2Xe4zcmLJTyZ80DKDB0Pmv2fN4-UOU_s,19943
|
|
200
200
|
cirq/experiments/two_qubit_xeb_test.py,sha256=ZeZvClUAB8ir42Bd3PWr-s0_-QKWbFdYqfvvOMawsm0,10204
|
|
201
201
|
cirq/experiments/xeb_fitting.py,sha256=tD678gTY495cDA6b55YIPdwq22VQFbB2AlnkeX_X9P0,29332
|
|
202
|
-
cirq/experiments/xeb_fitting_test.py,sha256=
|
|
202
|
+
cirq/experiments/xeb_fitting_test.py,sha256=0GQ6ifSWdvEJ6-ICIcSR-R9lFLRwBykgf6toLElmg0o,15483
|
|
203
203
|
cirq/experiments/xeb_sampling.py,sha256=6ZOidGi7Kt6p4cMQCjK7qQuIUXVHCYl47B2GnL8M-Bw,14987
|
|
204
204
|
cirq/experiments/xeb_sampling_test.py,sha256=0XkQGvcURsug3IblE_wZrHVDoOQV3WuQilrqCJbDHjI,6784
|
|
205
205
|
cirq/experiments/xeb_simulation.py,sha256=yML2NAnYTRFG1wsQHvxtNEGEMXuExbWjrE2JYuCqnrk,5076
|
|
206
|
-
cirq/experiments/xeb_simulation_test.py,sha256=
|
|
206
|
+
cirq/experiments/xeb_simulation_test.py,sha256=YWFKXPdtBFuZNhQoG06W1EetVhXighc3zyXwhKfGAeo,5652
|
|
207
207
|
cirq/interop/__init__.py,sha256=Xt1xU9UegP_jBNa9xaeOFSgtC0lYb_HNHq4hQQ0J20k,784
|
|
208
208
|
cirq/interop/quirk/__init__.py,sha256=W11jqaExSgvoUkjM_d0Kik4R8bqETF9Ezo27CDEB3iw,1237
|
|
209
209
|
cirq/interop/quirk/url_to_circuit.py,sha256=1ToWnFJdJIhCko9q62BEvOoCGxCpOUl8891IdCa52MM,14211
|
|
@@ -1184,8 +1184,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
|
|
|
1184
1184
|
cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
|
|
1185
1185
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1186
1186
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1187
|
-
cirq_core-1.5.0.
|
|
1188
|
-
cirq_core-1.5.0.
|
|
1189
|
-
cirq_core-1.5.0.
|
|
1190
|
-
cirq_core-1.5.0.
|
|
1191
|
-
cirq_core-1.5.0.
|
|
1187
|
+
cirq_core-1.5.0.dev20241014220150.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1188
|
+
cirq_core-1.5.0.dev20241014220150.dist-info/METADATA,sha256=jNq26KgknyxqyzNbqoC4aPPivs36NBAFxBmIJsJBjWA,1992
|
|
1189
|
+
cirq_core-1.5.0.dev20241014220150.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
1190
|
+
cirq_core-1.5.0.dev20241014220150.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1191
|
+
cirq_core-1.5.0.dev20241014220150.dist-info/RECORD,,
|
{cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.5.0.dev20241014205813.dist-info → cirq_core-1.5.0.dev20241014220150.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|