cirq-core 1.5.0.dev20250325011740__py3-none-any.whl → 1.5.0.dev20250325190513__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 CHANGED
@@ -28,4 +28,4 @@ if sys.version_info < (3, 10, 0): # pragma: no cover
28
28
  'of cirq (e.g. "python -m pip install cirq==1.1.*")'
29
29
  )
30
30
 
31
- __version__ = "1.5.0.dev20250325011740"
31
+ __version__ = "1.5.0.dev20250325190513"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq.__version__ == "1.5.0.dev20250325011740"
6
+ assert cirq.__version__ == "1.5.0.dev20250325190513"
@@ -15,6 +15,7 @@
15
15
  """Utility methods for transforming matrices or vectors."""
16
16
 
17
17
  import dataclasses
18
+ import functools
18
19
  from typing import Any, List, Optional, Sequence, Tuple, Union
19
20
 
20
21
  import numpy as np
@@ -29,8 +30,6 @@ from cirq.linalg import predicates
29
30
  # user provides a different np.array([]) value.
30
31
  RaiseValueErrorIfNotProvided: np.ndarray = np.array([])
31
32
 
32
- _NPY_MAXDIMS = 32 # Should be changed once numpy/numpy#5744 is resolved.
33
-
34
33
 
35
34
  def reflection_matrix_pow(reflection_matrix: np.ndarray, exponent: float):
36
35
  """Raises a matrix with two opposing eigenvalues to a power.
@@ -807,6 +806,15 @@ def transpose_flattened_array(t: np.ndarray, shape: Sequence[int], axes: Sequenc
807
806
  return ret
808
807
 
809
808
 
809
+ @functools.cache
810
+ def _can_numpy_support_dims(num_dims: int) -> bool:
811
+ try:
812
+ _ = np.empty((1,) * num_dims)
813
+ return True
814
+ except ValueError: # pragma: no cover
815
+ return False
816
+
817
+
810
818
  def can_numpy_support_shape(shape: Sequence[int]) -> bool:
811
819
  """Returns whether numpy supports the given shape or not numpy/numpy#5744."""
812
- return len(shape) <= _NPY_MAXDIMS
820
+ return min(shape, default=0) >= 0 and _can_numpy_support_dims(len(shape))
@@ -648,3 +648,8 @@ def test_transpose_flattened_array(num_dimensions):
648
648
  assert np.array_equal(want, got)
649
649
  got = linalg.transpose_flattened_array(A.reshape(shape), shape, axes).reshape(want.shape)
650
650
  assert np.array_equal(want, got)
651
+
652
+
653
+ @pytest.mark.parametrize('shape, result', [((), True), (30 * (1,), True), ((-3, 1, -1), False)])
654
+ def test_can_numpy_support_shape(shape: tuple[int, ...], result: bool) -> None:
655
+ assert linalg.can_numpy_support_shape(shape) is result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250325011740
3
+ Version: 1.5.0.dev20250325190513
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
@@ -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=d-6sJd05uGoRTtsLD5RUAfMZ_Loij6nd7W38mRx6_jM,1206
8
- cirq/_version_test.py,sha256=eUtDoSz2ow6ApcO_ln5Iy6ysSFcqsRy-LDjKQb01-Vk,147
7
+ cirq/_version.py,sha256=Lc-dZFmmTjfDfMNlr_PWRI7wVEojXjWZQgJkaApxRKs,1206
8
+ cirq/_version_test.py,sha256=7wCrRD8y9Lj7CDurSjRtSybR-0kdO8RSP8-kgpwns30,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=p-vEOa-8GQ2cFIAdze-kd6C1un1uRvtujVPljVKaHBg,13557
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -260,8 +260,8 @@ cirq/linalg/predicates.py,sha256=Q8BTlR4EvPg2KP9VodK78UEWYJbSCOTqRahn1DnFmSc,120
260
260
  cirq/linalg/predicates_test.py,sha256=UVDkNH2ujI80JwJwsDjbTgyALZUQJAVVCoFN1T_LLf0,21503
261
261
  cirq/linalg/tolerance.py,sha256=yHYVSHx2aoRci1aac9ZiM8OH1Bvy1Em-Rybnar701nE,1870
262
262
  cirq/linalg/tolerance_test.py,sha256=wnmuXIGEn_mugGoNm3AigSgjV2DMFdj8xpgRTMBbO7A,2355
263
- cirq/linalg/transformations.py,sha256=zWNDn55-1qLI-S6Z4K-E_cGhcBvd7HonWFbTEtdk0MI,32119
264
- cirq/linalg/transformations_test.py,sha256=ofrqw8H9109vVDBelSGkMjTPkmNinYsin4rvUE_iSn4,25095
263
+ cirq/linalg/transformations.py,sha256=5iNg4IOcYqfqDTYo5i983IxweyHiMwcHW8jdk9hpG34,32303
264
+ cirq/linalg/transformations_test.py,sha256=GsqD8_X0N88ECKr44t0O9wAJ6-uJJi0wExivn0Okf7M,25333
265
265
  cirq/neutral_atoms/__init__.py,sha256=VoQBkmZ5m4TPxjxShRixjqJbnc-IAnAWkGOPu8MBS5o,813
266
266
  cirq/neutral_atoms/convert_to_neutral_atom_gates.py,sha256=SsXFh1-NoBGqp4yX8-jIbIw-AK40baA-qh-iTL1wS6Q,1070
267
267
  cirq/neutral_atoms/convert_to_neutral_atom_gates_test.py,sha256=mIeGevxs9NoYpfTF_znHL67RrJKVQyQP-DPhn7t9SUA,1862
@@ -1206,8 +1206,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1206
1206
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1207
1207
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1208
1208
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1209
- cirq_core-1.5.0.dev20250325011740.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1210
- cirq_core-1.5.0.dev20250325011740.dist-info/METADATA,sha256=7i9e7_hzorhn4V5_bHicUgFm5Y4ysVIm5S6lRkWNl84,4817
1211
- cirq_core-1.5.0.dev20250325011740.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1212
- cirq_core-1.5.0.dev20250325011740.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1213
- cirq_core-1.5.0.dev20250325011740.dist-info/RECORD,,
1209
+ cirq_core-1.5.0.dev20250325190513.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1210
+ cirq_core-1.5.0.dev20250325190513.dist-info/METADATA,sha256=fQ44Z3lQDmmLmfaSmrEwcqFxvxWOb1sjNh7WbcyYrqo,4817
1211
+ cirq_core-1.5.0.dev20250325190513.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1212
+ cirq_core-1.5.0.dev20250325190513.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1213
+ cirq_core-1.5.0.dev20250325190513.dist-info/RECORD,,