cirq-core 1.6.0.dev20250618173543__py3-none-any.whl → 1.6.0.dev20250623211210__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.6.0.dev20250618173543"
31
+ __version__ = "1.6.0.dev20250623211210"
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.6.0.dev20250618173543"
6
+ assert cirq.__version__ == "1.6.0.dev20250623211210"
@@ -653,7 +653,7 @@ def test_tagged_operation_forwards_protocols() -> None:
653
653
  np.testing.assert_equal(cirq.unitary(tagged_h), cirq.unitary(h))
654
654
  assert cirq.has_unitary(tagged_h)
655
655
  assert cirq.decompose(tagged_h) == cirq.decompose(h)
656
- assert [*tagged_h._decompose_()] == cirq.decompose(h)
656
+ assert [*tagged_h._decompose_()] == cirq.decompose_once(h)
657
657
  assert cirq.pauli_expansion(tagged_h) == cirq.pauli_expansion(h)
658
658
  assert cirq.equal_up_to_global_phase(h, tagged_h)
659
659
  assert np.isclose(cirq.kraus(h), cirq.kraus(tagged_h)).all()
@@ -22,7 +22,8 @@ from typing import TYPE_CHECKING
22
22
 
23
23
  import numpy as np
24
24
 
25
- from cirq import circuits, ops, protocols
25
+ from cirq import ops, protocols
26
+ from cirq.circuits import Circuit, FrozenCircuit, Moment
26
27
  from cirq.protocols import unitary_protocol
27
28
  from cirq.protocols.has_stabilizer_effect_protocol import has_stabilizer_effect
28
29
  from cirq.protocols.has_unitary_protocol import has_unitary
@@ -113,7 +114,7 @@ def _is_single_qubit_operation(operation: ops.Operation) -> bool:
113
114
  return len(operation.qubits) == 1
114
115
 
115
116
 
116
- def _is_single_qubit_gate_moment(moment: circuits.Moment) -> bool:
117
+ def _is_single_qubit_gate_moment(moment: Moment) -> bool:
117
118
  return all(_is_single_qubit_operation(op) for op in moment)
118
119
 
119
120
 
@@ -121,9 +122,7 @@ def _is_clifford_op(op: ops.Operation) -> bool:
121
122
  return has_unitary(op) and has_stabilizer_effect(op)
122
123
 
123
124
 
124
- def _calc_busy_moment_range_of_each_qubit(
125
- circuit: circuits.FrozenCircuit,
126
- ) -> dict[ops.Qid, list[int]]:
125
+ def _calc_busy_moment_range_of_each_qubit(circuit: FrozenCircuit) -> dict[ops.Qid, list[int]]:
127
126
  busy_moment_range_by_qubit: dict[ops.Qid, list[int]] = {
128
127
  q: [len(circuit), -1] for q in circuit.all_qubits()
129
128
  }
@@ -134,7 +133,7 @@ def _calc_busy_moment_range_of_each_qubit(
134
133
  return busy_moment_range_by_qubit
135
134
 
136
135
 
137
- def _is_insertable_moment(moment: circuits.Moment, single_qubit_gate_moments_only: bool) -> bool:
136
+ def _is_insertable_moment(moment: Moment, single_qubit_gate_moments_only: bool) -> bool:
138
137
  return not single_qubit_gate_moments_only or _is_single_qubit_gate_moment(moment)
139
138
 
140
139
 
@@ -150,9 +149,7 @@ def _merge_single_qubit_ops_to_phxz(
150
149
  return gate.on(q)
151
150
 
152
151
 
153
- def _try_merge_single_qubit_ops_of_two_moments(
154
- m1: circuits.Moment, m2: circuits.Moment
155
- ) -> tuple[circuits.Moment, ...]:
152
+ def _try_merge_single_qubit_ops_of_two_moments(m1: Moment, m2: Moment) -> tuple[Moment, ...]:
156
153
  """Merge single qubit ops of 2 moments if possible, returns 2 moments otherwise."""
157
154
  for q in m1.qubits & m2.qubits:
158
155
  op1 = m1.operation_at(q)
@@ -169,12 +166,10 @@ def _try_merge_single_qubit_ops_of_two_moments(
169
166
  # ops_on_q may contain 1 op or 2 ops.
170
167
  ops_on_q = [op for op in [m.operation_at(q) for m in [m1, m2]] if op is not None]
171
168
  merged_ops.add(_merge_single_qubit_ops_to_phxz(q, tuple(ops_on_q)))
172
- return (circuits.Moment(merged_ops),)
169
+ return (Moment(merged_ops),)
173
170
 
174
171
 
175
- def _calc_pulled_through(
176
- moment: circuits.Moment, input_pauli_ops: ops.PauliString
177
- ) -> ops.PauliString:
172
+ def _calc_pulled_through(moment: Moment, input_pauli_ops: ops.PauliString) -> ops.PauliString:
178
173
  """Calculates the pulled_through such that circuit(input_pauli_ops, moment.clifford_ops) is
179
174
  equivalent to circuit(moment.clifford_ops, pulled_through).
180
175
  """
@@ -184,7 +179,7 @@ def _calc_pulled_through(
184
179
  return input_pauli_ops.after(clifford_ops_in_moment)
185
180
 
186
181
 
187
- def _get_stop_qubits(moment: circuits.Moment) -> set[ops.Qid]:
182
+ def _get_stop_qubits(moment: Moment) -> set[ops.Qid]:
188
183
  stop_pulling_through_qubits: set[ops.Qid] = set()
189
184
  for op in moment:
190
185
  if (not _is_clifford_op(op) and not _is_single_qubit_operation(op)) or not has_unitary(
@@ -233,7 +228,7 @@ def add_dynamical_decoupling(
233
228
  busy_moment_range_by_qubit = _calc_busy_moment_range_of_each_qubit(orig_circuit)
234
229
 
235
230
  # Stores all the moments of the output circuit chronologically.
236
- transformed_moments: list[circuits.Moment] = []
231
+ transformed_moments: list[Moment] = []
237
232
  # A PauliString stores the result of 'pulling' Pauli gates past each operations
238
233
  # right before the current moment.
239
234
  pulled_through: ops.PauliString = ops.PauliString()
@@ -277,7 +272,7 @@ def add_dynamical_decoupling(
277
272
  # Need to insert a new moment before current moment
278
273
  if new_moment_ops:
279
274
  moments_to_be_appended = _try_merge_single_qubit_ops_of_two_moments(
280
- transformed_moments[-1], circuits.Moment(new_moment_ops)
275
+ transformed_moments[-1], Moment(new_moment_ops)
281
276
  )
282
277
  if len(moments_to_be_appended) == 1:
283
278
  transformed_moments.pop()
@@ -291,7 +286,7 @@ def add_dynamical_decoupling(
291
286
  ):
292
287
  new_moment_ops.append(_update_pulled_through(q, next(dd_iter_by_qubits[q])))
293
288
  moments_to_be_appended = _try_merge_single_qubit_ops_of_two_moments(
294
- transformed_moments.pop(), circuits.Moment(new_moment_ops)
289
+ transformed_moments.pop(), Moment(new_moment_ops)
295
290
  )
296
291
  transformed_moments.extend(moments_to_be_appended)
297
292
 
@@ -325,7 +320,7 @@ def add_dynamical_decoupling(
325
320
  updated_moment_ops.add(updated_op)
326
321
 
327
322
  if updated_moment_ops:
328
- updated_moment = circuits.Moment(updated_moment_ops)
323
+ updated_moment = Moment(updated_moment_ops)
329
324
  transformed_moments.append(updated_moment)
330
325
 
331
326
  # Step 3, update pulled through.
@@ -339,8 +334,8 @@ def add_dynamical_decoupling(
339
334
  if ending_moment_ops:
340
335
  transformed_moments.extend(
341
336
  _try_merge_single_qubit_ops_of_two_moments(
342
- transformed_moments.pop(), circuits.Moment(ending_moment_ops)
337
+ transformed_moments.pop(), Moment(ending_moment_ops)
343
338
  )
344
339
  )
345
340
 
346
- return circuits.Circuit(transformed_moments)
341
+ return Circuit.from_moments(*transformed_moments)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.6.0.dev20250618173543
3
+ Version: 1.6.0.dev20250623211210
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=u8UjjcWIaPdjDo9p-_CSqJH-_FuA8zj2QQlCSKcqpP4,1206
8
- cirq/_version_test.py,sha256=l1RlWRlz5ss_-IrT-8jZH71heDWt0ecsUQJQpo3E79E,155
7
+ cirq/_version.py,sha256=G90gnyEVX9JtDLcpB4PPEGwM3AoV34GHtuCPBs-1o_M,1206
8
+ cirq/_version_test.py,sha256=meBCITA69x1ZUiBJi5gdRAf3wVjZQh2Fc51TH0ldfgo,155
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=hYyG53VJeV61X0oukK5ndZYega8lkL2FyaL1m0j6h5M,13556
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -367,7 +367,7 @@ cirq/ops/qubit_order_test.py,sha256=8uOW9oLLQcjbYvd2DdXZLCbRS2sJuH6b8Bal3SgPo5M,
367
367
  cirq/ops/random_gate_channel.py,sha256=i4eg9GA4CF6ZWQRrICa5lfYqvdZzN8oLEWwXHcxRStM,5115
368
368
  cirq/ops/random_gate_channel_test.py,sha256=p-xtDOMIYBJ1wVHLJmrALi-ZU978l3AVuX0kgoan1Ac,8523
369
369
  cirq/ops/raw_types.py,sha256=2QoHkWlVGAY3Yzkvlkop0GhLRdTMlHPGCIZNzffDjcI,43626
370
- cirq/ops/raw_types_test.py,sha256=SHQCxqriYaQHc63ORvrTAWGyhinZ0Zn5JvdCdyZIVAQ,35408
370
+ cirq/ops/raw_types_test.py,sha256=ROi20W_gtt5lmDV0-z7LWhEQm93Icg4AzA8OEvlMJVg,35413
371
371
  cirq/ops/state_preparation_channel.py,sha256=3qbqrrYaVN2eHL1qiBHcItj1Pzjxhtq10tSEkRz9GNM,4781
372
372
  cirq/ops/state_preparation_channel_test.py,sha256=xFi6nOFPoQatxvnorCXujmhMvtf65lmyFfxbGlTKo4c,6039
373
373
  cirq/ops/swap_gates.py,sha256=mEDVB4pdBsbenaOahrNtAcE2B1ZPW-4vGq079rECxf4,11743
@@ -1057,7 +1057,7 @@ cirq/transformers/drop_empty_moments.py,sha256=uZJG9FpUNyA1Mi0xLDuVuhj_siZhPZ1_s
1057
1057
  cirq/transformers/drop_empty_moments_test.py,sha256=h6Pji0z0o9KOB7fnSHseWpIAhzvxWurF_flg9XWm_YI,1959
1058
1058
  cirq/transformers/drop_negligible_operations.py,sha256=eP2dP_n0BYlr8aZ1wnD8YWsqCtwN0l0O6p45RbXEpfM,2097
1059
1059
  cirq/transformers/drop_negligible_operations_test.py,sha256=32mS4QQ8tiH3wBAAgbUU8LgwWDmvreRVEDZML_kgxyo,3859
1060
- cirq/transformers/dynamical_decoupling.py,sha256=miNFPpUGv2rLwkjujUMYEZuiamvA7x3vYTWie5jK79c,15137
1060
+ cirq/transformers/dynamical_decoupling.py,sha256=0FcSdAukav3Acw2sk-B1po5LiV4dx6egcS9F2YGSuIs,15044
1061
1061
  cirq/transformers/dynamical_decoupling_test.py,sha256=VeKlzaab_3fPDMiPaPihgvlbOWiJFflppMplSj0tfIo,44731
1062
1062
  cirq/transformers/eject_phased_paulis.py,sha256=ZeVEh614OihWZtHyaBBtgpWj_dUxQGXDzf4NmBlzbeM,14725
1063
1063
  cirq/transformers/eject_phased_paulis_test.py,sha256=AOMmOq3fWFGm2_qDyocjtF9fK7GAhC0kF550mkjtPx4,15791
@@ -1220,8 +1220,8 @@ cirq/work/sampler.py,sha256=rxbMWvrhu3gfNSBjZKozw28lLKVvBAS_1EGyPdYe8Xg,19041
1220
1220
  cirq/work/sampler_test.py,sha256=SsMrRvLDYELyOAWLKISjkdEfrBwLYWRsT6D8WrsLM3Q,13533
1221
1221
  cirq/work/zeros_sampler.py,sha256=Fs2JWwq0n9zv7_G5Rm-9vPeHUag7uctcMOHg0JTkZpc,2371
1222
1222
  cirq/work/zeros_sampler_test.py,sha256=lQLgQDGBLtfImryys2HzQ2jOSGxHgc7-koVBUhv8qYk,3345
1223
- cirq_core-1.6.0.dev20250618173543.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1224
- cirq_core-1.6.0.dev20250618173543.dist-info/METADATA,sha256=vboPt1qIiBB7xyV4-5_-4o-A11n3pYpOrrfK_q2GAVY,4857
1225
- cirq_core-1.6.0.dev20250618173543.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1226
- cirq_core-1.6.0.dev20250618173543.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1227
- cirq_core-1.6.0.dev20250618173543.dist-info/RECORD,,
1223
+ cirq_core-1.6.0.dev20250623211210.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1224
+ cirq_core-1.6.0.dev20250623211210.dist-info/METADATA,sha256=IruqpMesSLFKFDyo852-MHqtEd37-Jb2hQtTV1lQgv4,4857
1225
+ cirq_core-1.6.0.dev20250623211210.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1226
+ cirq_core-1.6.0.dev20250623211210.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1227
+ cirq_core-1.6.0.dev20250623211210.dist-info/RECORD,,