cirq-core 1.5.0.dev20240919204616__py3-none-any.whl → 1.5.0.dev20240920230222__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/_compat.py +3 -0
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/protocols/circuit_diagram_info_protocol.py +2 -0
- cirq/protocols/circuit_diagram_info_protocol_test.py +5 -0
- cirq/protocols/json_serialization_test.py +7 -0
- cirq/qis/states.py +1 -1
- cirq/sim/simulator.py +1 -1
- cirq/sim/sparse_simulator_test.py +4 -4
- {cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/METADATA +4 -4
- {cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/RECORD +14 -14
- {cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/WHEEL +0 -0
- {cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/top_level.txt +0 -0
cirq/_compat.py
CHANGED
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
|
@@ -277,6 +277,8 @@ class CircuitDiagramInfoArgs:
|
|
|
277
277
|
if self.precision is not None and not isinstance(radians, sympy.Basic):
|
|
278
278
|
quantity = self.format_real(radians / np.pi)
|
|
279
279
|
return quantity + unit
|
|
280
|
+
if isinstance(radians, np.number):
|
|
281
|
+
return str(radians)
|
|
280
282
|
return repr(radians)
|
|
281
283
|
|
|
282
284
|
def copy(self):
|
|
@@ -208,6 +208,9 @@ def test_format_real():
|
|
|
208
208
|
assert args.format_real(sympy.Symbol('t')) == 't'
|
|
209
209
|
assert args.format_real(sympy.Symbol('t') * 2 + 1) == '2*t + 1'
|
|
210
210
|
|
|
211
|
+
assert args.format_real(np.float64(1.1)) == '1.1'
|
|
212
|
+
assert args.format_real(np.int32(1)) == '1'
|
|
213
|
+
|
|
211
214
|
args.precision = None
|
|
212
215
|
assert args.format_real(1) == '1'
|
|
213
216
|
assert args.format_real(1.1) == '1.1'
|
|
@@ -252,6 +255,7 @@ def test_format_radians_without_precision():
|
|
|
252
255
|
assert args.format_radians(-np.pi) == '-pi'
|
|
253
256
|
assert args.format_radians(1.1) == '1.1'
|
|
254
257
|
assert args.format_radians(1.234567) == '1.234567'
|
|
258
|
+
assert args.format_radians(np.float32(1.234567)) == '1.234567'
|
|
255
259
|
assert args.format_radians(1 / 7) == repr(1 / 7)
|
|
256
260
|
assert args.format_radians(sympy.Symbol('t')) == 't'
|
|
257
261
|
assert args.format_radians(sympy.Symbol('t') * 2 + 1) == '2*t + 1'
|
|
@@ -261,6 +265,7 @@ def test_format_radians_without_precision():
|
|
|
261
265
|
assert args.format_radians(-np.pi) == '-π'
|
|
262
266
|
assert args.format_radians(1.1) == '1.1'
|
|
263
267
|
assert args.format_radians(1.234567) == '1.234567'
|
|
268
|
+
assert args.format_radians(np.float32(1.234567)) == '1.234567'
|
|
264
269
|
assert args.format_radians(1 / 7) == repr(1 / 7)
|
|
265
270
|
assert args.format_radians(sympy.Symbol('t')) == 't'
|
|
266
271
|
assert args.format_radians(sympy.Symbol('t') * 2 + 1) == '2*t + 1'
|
|
@@ -55,6 +55,13 @@ TESTED_MODULES: Dict[str, Optional[_ModuleDeprecation]] = {
|
|
|
55
55
|
'non_existent_should_be_fine': None,
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
# TODO(#6706) remove after cirq_rigetti supports NumPy 2.0
|
|
59
|
+
if np.__version__.startswith("2."): # pragma: no cover
|
|
60
|
+
warnings.warn(
|
|
61
|
+
"json_serialization_test - ignoring cirq_rigetti due to incompatibility with NumPy 2.0"
|
|
62
|
+
)
|
|
63
|
+
del TESTED_MODULES["cirq_rigetti"]
|
|
64
|
+
|
|
58
65
|
|
|
59
66
|
def _get_testspecs_for_modules() -> List[ModuleJsonTestSpec]:
|
|
60
67
|
modules = []
|
cirq/qis/states.py
CHANGED
|
@@ -264,7 +264,7 @@ def quantum_state(
|
|
|
264
264
|
dtype = DEFAULT_COMPLEX_DTYPE
|
|
265
265
|
data = one_hot(index=state, shape=(dim,), dtype=dtype)
|
|
266
266
|
else:
|
|
267
|
-
data = np.
|
|
267
|
+
data = np.asarray(state)
|
|
268
268
|
if qid_shape is None:
|
|
269
269
|
qid_shape = infer_qid_shape(state)
|
|
270
270
|
if data.ndim == 1 and data.dtype.kind != 'c':
|
cirq/sim/simulator.py
CHANGED
|
@@ -912,7 +912,7 @@ class SimulationTrialResult(Generic[TSimulatorState]):
|
|
|
912
912
|
def __str__(self) -> str:
|
|
913
913
|
def bitstring(vals):
|
|
914
914
|
separator = ' ' if np.max(vals) >= 10 else ''
|
|
915
|
-
return separator.join(str(
|
|
915
|
+
return separator.join(str(v.item()) for v in vals)
|
|
916
916
|
|
|
917
917
|
results = sorted([(key, bitstring(val)) for key, val in self.measurements.items()])
|
|
918
918
|
if not results:
|
|
@@ -115,7 +115,7 @@ def test_run_repetitions_terminal_measurement_stochastic():
|
|
|
115
115
|
q = cirq.LineQubit(0)
|
|
116
116
|
c = cirq.Circuit(cirq.H(q), cirq.measure(q, key='q'))
|
|
117
117
|
results = cirq.Simulator().run(c, repetitions=10000)
|
|
118
|
-
assert 1000 <=
|
|
118
|
+
assert 1000 <= np.count_nonzero(results.measurements['q']) < 9000
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
@pytest.mark.parametrize('dtype', [np.complex64, np.complex128])
|
|
@@ -255,7 +255,7 @@ def test_run_mixture(dtype: Type[np.complexfloating], split: bool):
|
|
|
255
255
|
simulator = cirq.Simulator(dtype=dtype, split_untangled_states=split)
|
|
256
256
|
circuit = cirq.Circuit(cirq.bit_flip(0.5)(q0), cirq.measure(q0))
|
|
257
257
|
result = simulator.run(circuit, repetitions=100)
|
|
258
|
-
assert 20 <
|
|
258
|
+
assert 20 < np.count_nonzero(result.measurements['q(0)']) < 80
|
|
259
259
|
|
|
260
260
|
|
|
261
261
|
@pytest.mark.parametrize('dtype', [np.complex64, np.complex128])
|
|
@@ -265,8 +265,8 @@ def test_run_mixture_with_gates(dtype: Type[np.complexfloating], split: bool):
|
|
|
265
265
|
simulator = cirq.Simulator(dtype=dtype, split_untangled_states=split, seed=23)
|
|
266
266
|
circuit = cirq.Circuit(cirq.H(q0), cirq.phase_flip(0.5)(q0), cirq.H(q0), cirq.measure(q0))
|
|
267
267
|
result = simulator.run(circuit, repetitions=100)
|
|
268
|
-
assert
|
|
269
|
-
assert
|
|
268
|
+
assert np.count_nonzero(result.measurements['q(0)']) < 80
|
|
269
|
+
assert np.count_nonzero(result.measurements['q(0)']) > 20
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
@pytest.mark.parametrize('dtype', [np.complex64, np.complex128])
|
{cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.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.dev20240920230222
|
|
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
|
|
@@ -12,17 +12,17 @@ Requires-Dist: attrs>=21.3.0
|
|
|
12
12
|
Requires-Dist: duet>=0.2.8
|
|
13
13
|
Requires-Dist: matplotlib~=3.0
|
|
14
14
|
Requires-Dist: networkx>=2.4
|
|
15
|
-
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: numpy>=1.24
|
|
16
16
|
Requires-Dist: pandas
|
|
17
17
|
Requires-Dist: sortedcontainers~=2.0
|
|
18
|
-
Requires-Dist: scipy~=1.
|
|
18
|
+
Requires-Dist: scipy~=1.8
|
|
19
19
|
Requires-Dist: sympy
|
|
20
20
|
Requires-Dist: typing-extensions>=4.2
|
|
21
21
|
Requires-Dist: tqdm
|
|
22
22
|
Provides-Extra: contrib
|
|
23
23
|
Requires-Dist: ply>=3.6; extra == "contrib"
|
|
24
24
|
Requires-Dist: pylatex~=1.4; extra == "contrib"
|
|
25
|
-
Requires-Dist: quimb
|
|
25
|
+
Requires-Dist: quimb>=1.8; extra == "contrib"
|
|
26
26
|
Requires-Dist: opt-einsum; extra == "contrib"
|
|
27
27
|
|
|
28
28
|
**This is a development version of Cirq-core and may be unstable.**
|
{cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/RECORD
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
cirq/__init__.py,sha256=Mb0NBH9rGcJCnEBoLapnbgJ5YHLCHNDBgPhHQcqWMF0,28084
|
|
2
|
-
cirq/_compat.py,sha256=
|
|
2
|
+
cirq/_compat.py,sha256=wl0Z7OYLpt07Vjts5l82jWjZE3WTy3uMHXaHwLwZKuo,29406
|
|
3
3
|
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=-C3j2477X7busXuzlcs-J0-YZhNm7DHadjhab9dNgw4,1206
|
|
8
|
+
cirq/_version_test.py,sha256=u0qppkhKiMQA5mo87foZaHIzxuDSoRpcl_Yk3zm6hEQ,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
|
|
@@ -385,8 +385,8 @@ cirq/protocols/apply_unitary_protocol.py,sha256=f2O-69F72e91QIEHPe9UBWLroim1mB6U
|
|
|
385
385
|
cirq/protocols/apply_unitary_protocol_test.py,sha256=ajjHvcBBv5n8Qh_hMPZkdsOvy1xJ774q4kuC25DJnKM,26136
|
|
386
386
|
cirq/protocols/approximate_equality_protocol.py,sha256=P5mWl9BWGpobw3K7iAoupFPSqO9V2yG82rfQHWTClmM,6313
|
|
387
387
|
cirq/protocols/approximate_equality_protocol_test.py,sha256=BYGw5iNU3lsdH5BUDPnqd9xfvfIo9-j5j0og_yXCQyY,9174
|
|
388
|
-
cirq/protocols/circuit_diagram_info_protocol.py,sha256=
|
|
389
|
-
cirq/protocols/circuit_diagram_info_protocol_test.py,sha256=
|
|
388
|
+
cirq/protocols/circuit_diagram_info_protocol.py,sha256=14hKWu2oMh65UQehXyLLBDh88ZMSijdqFUVjbhqLzDE,15989
|
|
389
|
+
cirq/protocols/circuit_diagram_info_protocol_test.py,sha256=dSvjaGEbMGuSrs4kpFen5Z-_dC1JzPvl27Dg47di4A0,10415
|
|
390
390
|
cirq/protocols/commutes_protocol.py,sha256=KW849TNso6d_pzTlAN8SRN2pjz72LJ8uAhQSYS60K3Q,7470
|
|
391
391
|
cirq/protocols/commutes_protocol_test.py,sha256=h0Lky4jrs7Hxrh4MeHxmxNciuofKGGZ2eC-ceWP8wKU,5849
|
|
392
392
|
cirq/protocols/control_key_protocol.py,sha256=S3b4XOvTIj6TxNbj0W33fjdvXiWSKOtflvfEGeruzWw,2630
|
|
@@ -403,7 +403,7 @@ cirq/protocols/hash_from_pickle_test.py,sha256=kjGb1_7Hil8egA3b_fkvA8xOJpuac0vd5
|
|
|
403
403
|
cirq/protocols/inverse_protocol.py,sha256=CEqtGRRj86WQyyALonRXxQrNq-fENOs_Zqrlr_BVau8,4115
|
|
404
404
|
cirq/protocols/inverse_protocol_test.py,sha256=pqqIU4_G4Npc9Z-SeoM9eCB2T5JRTeI02NCXhP0UtaI,2017
|
|
405
405
|
cirq/protocols/json_serialization.py,sha256=Otrrzsi74rfE_2wbK-xBUI3QzQaRnEXqsY1D_ktW4jk,24360
|
|
406
|
-
cirq/protocols/json_serialization_test.py,sha256=
|
|
406
|
+
cirq/protocols/json_serialization_test.py,sha256=kOM7-DWVy0jy7SBx-RgNNiExm-Ot4wbYm0JKtl9uF0w,27737
|
|
407
407
|
cirq/protocols/kraus_protocol.py,sha256=GKQ748yxo6B6i0jUzq8OyR6lcEFYbh4FV2UryjUgSuk,9158
|
|
408
408
|
cirq/protocols/kraus_protocol_test.py,sha256=QpPwkk7XBiGKNdrOcjXqtvhESVbUzujnUPz47uUNyqc,5401
|
|
409
409
|
cirq/protocols/measurement_key_protocol.py,sha256=hl7xFi1Evebh8MQNLuUffhsUkggr4SdWUm4kIr9s2iI,13425
|
|
@@ -887,7 +887,7 @@ cirq/qis/measures_test.py,sha256=3LTTGdvuFfZWmFyWFeUHpg1yGc9z0VE8j7Kd7J7y8i4,100
|
|
|
887
887
|
cirq/qis/noise_utils.py,sha256=wakkdQdBzOUWCf71sCxMCWwfPPAnJi5bNYsXDzGzkx0,3680
|
|
888
888
|
cirq/qis/noise_utils_test.py,sha256=6r99DBN_2bImZbuOIB2A9ZdvyipqDopXsoxV-8OUK_I,3391
|
|
889
889
|
cirq/qis/quantum_state_representation.py,sha256=5ybXGqjGSpSZqOn9q6OW6IBOmJs8KQekv5fFZZMCqZQ,3238
|
|
890
|
-
cirq/qis/states.py,sha256=
|
|
890
|
+
cirq/qis/states.py,sha256=jB_U-MowGZ_280ivlzkSNjB5oG8GTPnPb8M_eGTr5Yo,42005
|
|
891
891
|
cirq/qis/states_test.py,sha256=I4fHt5drqG0C36bvmU-H7DfY3zOC8CfiZFzKJvSOnFs,31813
|
|
892
892
|
cirq/sim/__init__.py,sha256=J209uAbjmgzER-48Q-FkRUWQ1FlG6-1c7GK11owZIW4,3452
|
|
893
893
|
cirq/sim/classical_simulator.py,sha256=orp2WY15HNCJk60Aosq7igO3bjKcWjAAOeU_CiPK_98,9349
|
|
@@ -907,12 +907,12 @@ cirq/sim/simulation_state_base.py,sha256=95FDt2omBxU-3KXwii6KCKMC9MtXRc1ZtnLZRE8
|
|
|
907
907
|
cirq/sim/simulation_state_test.py,sha256=ubfkvFui9zPQwC6aJw9rmehd_4oDQCi6L3Pe1EVznAE,7410
|
|
908
908
|
cirq/sim/simulation_utils.py,sha256=74Jvi2m4HcRo0i1h7MNvul3Ho0Io8HW0KARA3Ntjh_4,2553
|
|
909
909
|
cirq/sim/simulation_utils_test.py,sha256=1YCuaKFf0JfOqdEbdYE49wlNWmhmtQKUQMIij6YyiDo,1333
|
|
910
|
-
cirq/sim/simulator.py,sha256=
|
|
910
|
+
cirq/sim/simulator.py,sha256=tvev0Qqv8qG66cr7JCK5u6vr48__1lh-vKLHQNoR2-4,41877
|
|
911
911
|
cirq/sim/simulator_base.py,sha256=mAcIKPT6lsIvAJFdSC4a-cGQFU0kegqbL80K1K7mlFM,18186
|
|
912
912
|
cirq/sim/simulator_base_test.py,sha256=Ik_28QV2Pzdc4tGxYMAVnGrNG1IWMiwuKUJcaCeuG7M,14955
|
|
913
913
|
cirq/sim/simulator_test.py,sha256=9cHMoY7M5_82gfeBsCg6O0PnictzZu172vQAgUngJqA,18119
|
|
914
914
|
cirq/sim/sparse_simulator.py,sha256=OvVjqNk5Kb92DM8Nrdw1BGOB7GFlT6yiXwIPpAcLV7I,12854
|
|
915
|
-
cirq/sim/sparse_simulator_test.py,sha256=
|
|
915
|
+
cirq/sim/sparse_simulator_test.py,sha256=HJQ6yDqpg2BY6KN3eFg9b-i1qsr0sImxOCuTqJRbwFI,53584
|
|
916
916
|
cirq/sim/state_vector.py,sha256=N6N9EELlW66UaLTBaq62ms0XkfIK7CzN9SBM7t52dXo,13428
|
|
917
917
|
cirq/sim/state_vector_simulation_state.py,sha256=e4it_DT1J-30S3OX_gfMJiWAttFaVOMEPQ-Y1ARWnDg,17616
|
|
918
918
|
cirq/sim/state_vector_simulation_state_test.py,sha256=UtGMIurlV6N74nX7qoVnGoRhwF35-ghDEIP7Mj5AXmI,9841
|
|
@@ -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.dev20240920230222.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1188
|
+
cirq_core-1.5.0.dev20240920230222.dist-info/METADATA,sha256=LPHKLIaEgzqdgvycbFNgZpBf01KtRnTXhsxa-SPQIUI,1992
|
|
1189
|
+
cirq_core-1.5.0.dev20240920230222.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
1190
|
+
cirq_core-1.5.0.dev20240920230222.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1191
|
+
cirq_core-1.5.0.dev20240920230222.dist-info/RECORD,,
|
{cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.5.0.dev20240919204616.dist-info → cirq_core-1.5.0.dev20240920230222.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|