cirq-core 1.7.0.dev20250905010328__py3-none-any.whl → 1.7.0.dev20250908175350__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, 11, 0): # pragma: no cover
28
28
  'of Cirq (e.g. "python -m pip install cirq==1.5.0")'
29
29
  )
30
30
 
31
- __version__ = "1.7.0.dev20250905010328"
31
+ __version__ = "1.7.0.dev20250908175350"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version() -> None:
6
- assert cirq.__version__ == "1.7.0.dev20250905010328"
6
+ assert cirq.__version__ == "1.7.0.dev20250908175350"
cirq/circuits/circuit.py CHANGED
@@ -3002,13 +3002,15 @@ def get_earliest_accommodating_moment_index(
3002
3002
  mop_index = last_conflict + 1
3003
3003
 
3004
3004
  # Update our dicts with data from this `mop` placement. Note `mop_index` will always be greater
3005
- # than the existing value for all of these, by construction.
3005
+ # than the existing value for qubits and measurement keys, by construction.
3006
3006
  for qubit in mop_qubits:
3007
3007
  qubit_indices[qubit] = mop_index
3008
3008
  for key in mop_mkeys:
3009
3009
  mkey_indices[key] = mop_index
3010
+ # For control keys, keep the maximum moment index seen so far because ops with the same control
3011
+ # keys can commute past each other.
3010
3012
  for key in mop_ckeys:
3011
- ckey_indices[key] = mop_index
3013
+ ckey_indices[key] = max(mop_index, ckey_indices.get(key, -1))
3012
3014
 
3013
3015
  return mop_index
3014
3016
 
@@ -208,6 +208,24 @@ def test_append_control_key() -> None:
208
208
  assert len(c) == 1
209
209
 
210
210
 
211
+ def test_append_control_key_before_measure() -> None:
212
+ c = cirq.Circuit()
213
+ q1, q2 = cirq.LineQubit.range(2)
214
+ c.append(cirq.X(q1))
215
+ c.append(cirq.X(q1))
216
+ c.append(cirq.X(q1).with_classical_controls('a'))
217
+ c.append(cirq.X(q2).with_classical_controls('a'))
218
+ c.append(cirq.measure(q2, key='a'))
219
+ assert c == cirq.Circuit(
220
+ [
221
+ cirq.Moment(cirq.X(q1), cirq.X(q2).with_classical_controls('a')),
222
+ cirq.Moment(cirq.X(q1)),
223
+ cirq.Moment(cirq.X(q1).with_classical_controls('a')),
224
+ cirq.Moment(cirq.measure(q2, key='a')),
225
+ ]
226
+ )
227
+
228
+
211
229
  def test_append_multiple() -> None:
212
230
  a = cirq.NamedQubit('a')
213
231
  b = cirq.NamedQubit('b')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.7.0.dev20250905010328
3
+ Version: 1.7.0.dev20250908175350
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=emXpdD5ZvwLRlFAoQB8YatmZyU3b4e9jg6FppMTUhkU,33900
4
4
  cirq/_doc.py,sha256=BrnoABo1hk5RgB3Cgww4zLHUfiyFny0F1V-tOMCbdaU,2909
5
5
  cirq/_import.py,sha256=ixBu4EyGl46Ram2cP3p5eZVEFDW5L2DS-VyTjz4N9iw,8429
6
6
  cirq/_import_test.py,sha256=oF4izzOVZLc7NZ0aZHFcGv-r01eiFFt_JORx_x7_D4s,1089
7
- cirq/_version.py,sha256=q1LJrtuMbezkbycUehrLxIj3x9Z3cRoYoV0PWfBHUrM,1206
8
- cirq/_version_test.py,sha256=0d4wVVD31GQ1YC5rofqz7K0_qDF4vJnB8elRjvHJ1c8,155
7
+ cirq/_version.py,sha256=ugpT8Mxw0DbpT3PbJ0x2YveUrPIlQ98wWxYdIoQNGeo,1206
8
+ cirq/_version_test.py,sha256=Kmu_kSjTII0eGwoABuBiUJSMRq5KFXo9mYj7qAEMbtA,155
9
9
  cirq/conftest.py,sha256=wSDKNdIQRDfLnXvOCWD3erheOw8JHRhdfQ53EyTUIXg,1239
10
10
  cirq/json_resolver_cache.py,sha256=A5DIgFAY1hUNt9vai_C3-gGBv24116CJMzQxMcXOax4,13726
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -16,10 +16,10 @@ cirq/circuits/_box_drawing_character_data.py,sha256=hExbMJHm9LGORhlhNiUvPiHquv4p
16
16
  cirq/circuits/_box_drawing_character_data_test.py,sha256=GyiNQDtiu_drzEe_y8DOXCFRYDKr2k8KetXN5RVDp18,1668
17
17
  cirq/circuits/_bucket_priority_queue.py,sha256=U564r2mou4aZsOlpVYiZCgirqS6mVznG3ESyawBt4gE,6749
18
18
  cirq/circuits/_bucket_priority_queue_test.py,sha256=MOby-UKYZQMe2n4KhqkfDCPrz-T_3eBbWDEa0_nadJQ,5627
19
- cirq/circuits/circuit.py,sha256=_5i3X0ICHZInOgPbK98v0usdHDr6YU7ONxgr9DXLGkM,122773
19
+ cirq/circuits/circuit.py,sha256=sBUG4Tm2KXYkwiPPJ_HDYBJM6fkhb_Qxfny93wXANCw,122960
20
20
  cirq/circuits/circuit_operation.py,sha256=vvLk30okWhimdJRFhFOpwoHDkyOHzR2I9OIggZaqmVk,36338
21
21
  cirq/circuits/circuit_operation_test.py,sha256=ZoYvAIsURx9yPWiLcPeX3--lkCOFJkXLxHafUJaZf1U,50425
22
- cirq/circuits/circuit_test.py,sha256=Q1ywfvVp6ThmtkAKTk-5bq0cVKctncL0d1qoWxTL_r4,166579
22
+ cirq/circuits/circuit_test.py,sha256=fT08nAEf-aiA5cvboBYnfLPGJHxauGIzJ2_Iw0fWT40,167182
23
23
  cirq/circuits/frozen_circuit.py,sha256=UXwABQqBSnSKqSWmRluQPD09xZU0orSW3b3IHvDqxUw,7903
24
24
  cirq/circuits/frozen_circuit_test.py,sha256=1Uk3g9St_nJFmu3IJ5hAcXWJjLfWFUXTCKQU1b0JJrE,5321
25
25
  cirq/circuits/insert_strategy.py,sha256=3995vK4U6O9RV4BXMoFl9Tf3ekxIiqxv71IuX80JtYo,3237
@@ -1234,8 +1234,8 @@ cirq/work/sampler.py,sha256=rxbMWvrhu3gfNSBjZKozw28lLKVvBAS_1EGyPdYe8Xg,19041
1234
1234
  cirq/work/sampler_test.py,sha256=SsMrRvLDYELyOAWLKISjkdEfrBwLYWRsT6D8WrsLM3Q,13533
1235
1235
  cirq/work/zeros_sampler.py,sha256=Fs2JWwq0n9zv7_G5Rm-9vPeHUag7uctcMOHg0JTkZpc,2371
1236
1236
  cirq/work/zeros_sampler_test.py,sha256=lQLgQDGBLtfImryys2HzQ2jOSGxHgc7-koVBUhv8qYk,3345
1237
- cirq_core-1.7.0.dev20250905010328.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
- cirq_core-1.7.0.dev20250905010328.dist-info/METADATA,sha256=bP-Hm__LxWLXkxLpbTbH4PSEc6xitwjvV1B71sMpco4,4758
1239
- cirq_core-1.7.0.dev20250905010328.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
- cirq_core-1.7.0.dev20250905010328.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
- cirq_core-1.7.0.dev20250905010328.dist-info/RECORD,,
1237
+ cirq_core-1.7.0.dev20250908175350.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1238
+ cirq_core-1.7.0.dev20250908175350.dist-info/METADATA,sha256=Yy3uSY4hYqiMoGKfP592Ae4mqX8e_BkNju2jjpJp9Ac,4758
1239
+ cirq_core-1.7.0.dev20250908175350.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1240
+ cirq_core-1.7.0.dev20250908175350.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1241
+ cirq_core-1.7.0.dev20250908175350.dist-info/RECORD,,