cirq-core 1.5.0.dev20240814221152__py3-none-any.whl → 1.5.0.dev20240819032820__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.dev20240814221152"
31
+ __version__ = "1.5.0.dev20240819032820"
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.dev20240814221152"
6
+ assert cirq.__version__ == "1.5.0.dev20240819032820"
cirq/ops/identity.py CHANGED
@@ -13,13 +13,14 @@
13
13
  # limitations under the License.
14
14
  """IdentityGate."""
15
15
 
16
- from typing import Any, Dict, Optional, Tuple, TYPE_CHECKING, Sequence
16
+ from typing import Any, Dict, Optional, Tuple, TYPE_CHECKING, Sequence, Union
17
17
 
18
18
  import numpy as np
19
19
  import sympy
20
20
 
21
21
  from cirq import protocols, value
22
22
  from cirq._doc import document
23
+ from cirq.type_workarounds import NotImplementedType
23
24
  from cirq.ops import raw_types
24
25
 
25
26
  if TYPE_CHECKING:
@@ -75,6 +76,12 @@ class IdentityGate(raw_types.Gate):
75
76
  return self
76
77
  return NotImplemented
77
78
 
79
+ def _commutes_(self, other: Any, *, atol: float = 1e-8) -> Union[bool, NotImplementedType]:
80
+ """The identity gate commutes with all other gates."""
81
+ if not isinstance(other, raw_types.Gate):
82
+ return NotImplemented
83
+ return True
84
+
78
85
  def _has_unitary_(self) -> bool:
79
86
  return True
80
87
 
cirq/ops/identity_test.py CHANGED
@@ -208,3 +208,9 @@ def test_identity_short_circuits_act_on():
208
208
  args = mock.Mock(cirq.SimulationState)
209
209
  args._act_on_fallback_.side_effect = mock.Mock(side_effect=Exception('No!'))
210
210
  cirq.act_on(cirq.IdentityGate(1)(cirq.LineQubit(0)), args)
211
+
212
+
213
+ def test_identity_commutes():
214
+ assert cirq.commutes(cirq.I, cirq.X)
215
+ with pytest.raises(TypeError):
216
+ cirq.commutes(cirq.I, "Gate")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20240814221152
3
+ Version: 1.5.0.dev20240819032820
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=1bB16cK2tv4gErFbbZYs77OQSV_hic5PnSGQwqGHZmI,1206
8
- cirq/_version_test.py,sha256=5rnH4LiOiOoi5GNI-BWvy9b5Euhv8m4oyCqfz4nKqnM,147
7
+ cirq/_version.py,sha256=JEiiqQfLizhjNs8BjD9lOU8j3-0umSFic8UR9I580do,1206
8
+ cirq/_version_test.py,sha256=IQENR-y0jVtii_k8k3Y0oD2vWNDQpblccARkug3cXNQ,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
@@ -303,8 +303,8 @@ cirq/ops/global_phase_op.py,sha256=XYnzmquhGaVY91oYm9RHo1qbX1eOx2ZqLPzLsl8jyQw,4
303
303
  cirq/ops/global_phase_op_test.py,sha256=FjtUsohIYabTtiGytvPQw9Rzkqd6dlT7qrj4oltDbTI,9814
304
304
  cirq/ops/greedy_qubit_manager.py,sha256=O9qY8GB1KGxm3B7JEjq50sGVD51bNwTSupJpi3WUeAc,4039
305
305
  cirq/ops/greedy_qubit_manager_test.py,sha256=iVZDKes-r08raTiJHpYNmP-Dp89ok3hIU-QboL2BHdw,3300
306
- cirq/ops/identity.py,sha256=4H67nV4i85wi3HWY-k5ImC9hX9U6BjIZp61JalHpsTI,5503
307
- cirq/ops/identity_test.py,sha256=dGx9nzeFCoVo3SmlEbqCGJT1XyzJh-qoPl9n2gEd9WQ,7422
306
+ cirq/ops/identity.py,sha256=vS4Gown5dJWm89gNKBZ9vXQL3ijwAJZ9JFu7NtfAQw8,5827
307
+ cirq/ops/identity_test.py,sha256=-z5TjxNaD3_z73nGdR3RbHt6ytaYOAyYggCzwZtlQDw,7568
308
308
  cirq/ops/kraus_channel.py,sha256=tCPAEzr_GAL5vTwI43rBoiOnT04l-ebZanuuEuYWDo8,5085
309
309
  cirq/ops/kraus_channel_test.py,sha256=qH2Y9cngXzKCabd-Mq5xBYcM_wyL8c6KkrXw8kZr7Dc,4726
310
310
  cirq/ops/linear_combinations.py,sha256=vK-IKHwdIBbOEaUz92JaA3uC4WTIDgUYCOCa1zZpdkw,39685
@@ -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.dev20240814221152.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1188
- cirq_core-1.5.0.dev20240814221152.dist-info/METADATA,sha256=gQBwwQrQXe5-T8Eqh4McfR1gYpPpnnVEBJxxbdz1nDY,1992
1189
- cirq_core-1.5.0.dev20240814221152.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1190
- cirq_core-1.5.0.dev20240814221152.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1191
- cirq_core-1.5.0.dev20240814221152.dist-info/RECORD,,
1187
+ cirq_core-1.5.0.dev20240819032820.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1188
+ cirq_core-1.5.0.dev20240819032820.dist-info/METADATA,sha256=k8f5jgbodK_sJ0g_KjxFH-jPBzF0BpZhHkoXoyfNlc0,1992
1189
+ cirq_core-1.5.0.dev20240819032820.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
1190
+ cirq_core-1.5.0.dev20240819032820.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1191
+ cirq_core-1.5.0.dev20240819032820.dist-info/RECORD,,