cirq-core 1.5.0.dev20250122154326__py3-none-any.whl → 1.5.0.dev20250122193351__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.dev20250122154326"
31
+ __version__ = "1.5.0.dev20250122193351"
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.dev20250122154326"
6
+ assert cirq.__version__ == "1.5.0.dev20250122193351"
@@ -38,7 +38,7 @@ class _BaseGridQid(ops.Qid):
38
38
 
39
39
  def __hash__(self) -> int:
40
40
  if self._hash is None:
41
- self._hash = hash((self._row, self._col, self._dimension))
41
+ self._hash = ((self._dimension - 2) * 1_000_003 + self._col) * 1_000_003 + self._row
42
42
  return self._hash
43
43
 
44
44
  def __eq__(self, other) -> bool:
@@ -34,7 +34,7 @@ class _BaseLineQid(ops.Qid):
34
34
 
35
35
  def __hash__(self) -> int:
36
36
  if self._hash is None:
37
- self._hash = hash((self._x, self._dimension))
37
+ self._hash = (self._dimension - 2) * 1_000_003 + self._x
38
38
  return self._hash
39
39
 
40
40
  def __eq__(self, other) -> bool:
cirq/sim/simulator.py CHANGED
@@ -973,9 +973,10 @@ def split_into_matching_protocol_then_general(
973
973
  qubit A will cause later operations on A to be part of the non-matching
974
974
  suffix, but later operations on other qubits will continue to be put into
975
975
  the matching part (as long as those qubits have had no non-matching operation
976
- up to that point).
976
+ up to that point). Measurement keys are handled equivalently.
977
977
  """
978
978
  blocked_qubits: Set[cirq.Qid] = set()
979
+ blocked_keys: Set[cirq.MeasurementKey] = set()
979
980
  matching_prefix = circuits.Circuit()
980
981
  general_suffix = circuits.Circuit()
981
982
  for moment in circuit:
@@ -983,12 +984,12 @@ def split_into_matching_protocol_then_general(
983
984
  general_part = []
984
985
  for op in moment:
985
986
  qs = set(op.qubits)
986
- if not predicate(op) or not qs.isdisjoint(blocked_qubits):
987
- blocked_qubits |= qs
988
-
989
- if qs.isdisjoint(blocked_qubits):
987
+ keys = protocols.measurement_keys_touched(op)
988
+ if predicate(op) and qs.isdisjoint(blocked_qubits) and keys.isdisjoint(blocked_keys):
990
989
  matching_part.append(op)
991
990
  else:
991
+ blocked_qubits |= qs
992
+ blocked_keys |= keys
992
993
  general_part.append(op)
993
994
  if matching_part:
994
995
  matching_prefix.append(circuits.Moment(matching_part))
@@ -399,6 +399,17 @@ def test_sample_repeated_measurement_keys():
399
399
  assert len(result.records['b'][0]) == 2
400
400
 
401
401
 
402
+ def test_classical_controls_go_to_suffix_if_corresponding_measurement_does():
403
+ subcircuit = cirq.CircuitOperation(cirq.FrozenCircuit()).with_classical_controls('a')
404
+ m = cirq.measure(cirq.LineQubit(0), key='a')
405
+ circuit = cirq.Circuit(m, subcircuit)
406
+ prefix, suffix = cirq.sim.simulator.split_into_matching_protocol_then_general(
407
+ circuit, lambda op: op != m # any op but m goes into prefix
408
+ )
409
+ assert not prefix
410
+ assert suffix == circuit
411
+
412
+
402
413
  def test_simulate_with_invert_mask():
403
414
  q0, q1, q2, q3, q4 = cirq.LineQid.for_qid_shape((2, 3, 3, 3, 4))
404
415
  c = cirq.Circuit(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250122154326
3
+ Version: 1.5.0.dev20250122193351
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=fTKdmX6uzT4CUgMsCpHpp_ORy5_o9MHO1oCKkHNewo4,1206
8
- cirq/_version_test.py,sha256=Uy41AdBF00p__C3v9oyYksMvAmP0UEJfFo2w2dzBbr0,147
7
+ cirq/_version.py,sha256=WFhJmgYICxtpdKSoM9Ddzu3ntb_okVm0AooNMz81zBE,1206
8
+ cirq/_version_test.py,sha256=h5jubeUTqzv-sokoqfTg1Fz-9jU9O4F8vV9KQ88ThCs,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
@@ -157,11 +157,11 @@ cirq/devices/device.py,sha256=9rUZwpbbmqk8AUVH4N4KfJ59j5im7hVgDJAHtN9iH_0,5361
157
157
  cirq/devices/device_test.py,sha256=v3gT6jrGLLfYnZbTizIaIMkI3s5_xVM3OV9JQchvAxY,1124
158
158
  cirq/devices/grid_device_metadata.py,sha256=h4Xo_PaiZqQSVUgb1ctVtYYYE2tNik2KQhCgooilZrE,8629
159
159
  cirq/devices/grid_device_metadata_test.py,sha256=IeOqYOZcUGhB4ivuQW2g0Q9dt-zFA0H6Dav6yv6Lul0,8592
160
- cirq/devices/grid_qubit.py,sha256=CeR3ILjzN6H6UjOp2KBhxOoVSjX1TFaAUvbmsU-uGuQ,18793
160
+ cirq/devices/grid_qubit.py,sha256=ynJYYih1QcZPLuNQYbooJWvSruhlep6qKFdiwdfVuSk,18819
161
161
  cirq/devices/grid_qubit_test.py,sha256=EzI8dWWnCfYbwruwsKlBzb41lQTA6AEOB2X16oQAz-0,14044
162
162
  cirq/devices/insertion_noise_model.py,sha256=-X07pSTp-lxQj6AQT_89gTHx_jKtI9GSMrD4dozCwTs,3614
163
163
  cirq/devices/insertion_noise_model_test.py,sha256=i9jB257VXO5wi5QdDO5G4tphx5RKMaouUsdsQT3kiBU,3992
164
- cirq/devices/line_qubit.py,sha256=q7rqUx8Pda3hlL8u6Zu2Ufe0eI5IN5m8Kz_oyBV_yTw,11825
164
+ cirq/devices/line_qubit.py,sha256=SFN7VaxVhcEnH9VPtqPeQ3Aygp0xa8kZ0yntkI_DiVc,11836
165
165
  cirq/devices/line_qubit_test.py,sha256=_X1ofFHtuo0myFfsu1nlTJf9OLuLWRgZHHW2VG23ERY,9547
166
166
  cirq/devices/named_topologies.py,sha256=grFXvi0UDHZl1pRyHDWSqjub3xF_Yf7RLXfMAZbyoEA,15790
167
167
  cirq/devices/named_topologies_test.py,sha256=Nj_tlGmqPH7IVUzpUHPnAPlfUWhSGbZsIHdsLLjxIZs,4736
@@ -923,10 +923,10 @@ cirq/sim/simulation_state_base.py,sha256=1t6dWLpxJDiVvld9kl91A9OGTNY6ZkWrceaHf-q
923
923
  cirq/sim/simulation_state_test.py,sha256=ubfkvFui9zPQwC6aJw9rmehd_4oDQCi6L3Pe1EVznAE,7410
924
924
  cirq/sim/simulation_utils.py,sha256=hsR4ea2eERW3ugNPSheE0bNBYEcJl6US-a6rmu7CSOA,2598
925
925
  cirq/sim/simulation_utils_test.py,sha256=1YCuaKFf0JfOqdEbdYE49wlNWmhmtQKUQMIij6YyiDo,1333
926
- cirq/sim/simulator.py,sha256=tvev0Qqv8qG66cr7JCK5u6vr48__1lh-vKLHQNoR2-4,41877
926
+ cirq/sim/simulator.py,sha256=d5EFMunjzPATr5p3O4e8x0c-Ee3Bd3XQeOfyPXBwPsQ,42046
927
927
  cirq/sim/simulator_base.py,sha256=mAcIKPT6lsIvAJFdSC4a-cGQFU0kegqbL80K1K7mlFM,18186
928
928
  cirq/sim/simulator_base_test.py,sha256=Ik_28QV2Pzdc4tGxYMAVnGrNG1IWMiwuKUJcaCeuG7M,14955
929
- cirq/sim/simulator_test.py,sha256=9cHMoY7M5_82gfeBsCg6O0PnictzZu172vQAgUngJqA,18119
929
+ cirq/sim/simulator_test.py,sha256=wlJLnCfPfIHbJ2On6Lb5iJPSxkjjgMaB5GXOJvwSby8,18589
930
930
  cirq/sim/sparse_simulator.py,sha256=OvVjqNk5Kb92DM8Nrdw1BGOB7GFlT6yiXwIPpAcLV7I,12854
931
931
  cirq/sim/sparse_simulator_test.py,sha256=HJQ6yDqpg2BY6KN3eFg9b-i1qsr0sImxOCuTqJRbwFI,53584
932
932
  cirq/sim/state_vector.py,sha256=N6N9EELlW66UaLTBaq62ms0XkfIK7CzN9SBM7t52dXo,13428
@@ -1202,8 +1202,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1202
1202
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1203
1203
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1204
1204
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1205
- cirq_core-1.5.0.dev20250122154326.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1206
- cirq_core-1.5.0.dev20250122154326.dist-info/METADATA,sha256=3TuLZ_0x0juwPRhwEAg-BZySuiwhYxKN1TW1RWvAGNw,2105
1207
- cirq_core-1.5.0.dev20250122154326.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1208
- cirq_core-1.5.0.dev20250122154326.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1209
- cirq_core-1.5.0.dev20250122154326.dist-info/RECORD,,
1205
+ cirq_core-1.5.0.dev20250122193351.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1206
+ cirq_core-1.5.0.dev20250122193351.dist-info/METADATA,sha256=CgeMBbwsI8eAcEZR-fru-N4jHXdUTXfxB9qoPBt4yJM,2105
1207
+ cirq_core-1.5.0.dev20250122193351.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1208
+ cirq_core-1.5.0.dev20250122193351.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1209
+ cirq_core-1.5.0.dev20250122193351.dist-info/RECORD,,