cirq-core 1.6.0.dev20250627024936__py3-none-any.whl → 1.6.0.dev20250627201540__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.dev20250627024936"
31
+ __version__ = "1.6.0.dev20250627201540"
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.dev20250627024936"
6
+ assert cirq.__version__ == "1.6.0.dev20250627201540"
@@ -226,12 +226,15 @@ def _merge_single_qubit_gates(
226
226
  transformation.
227
227
  Returns:
228
228
  new sequence of operations after merging gates
229
+
230
+ Raises:
231
+ ValueError: if one of the operations is not on 1 or 2 qubits
229
232
  """
230
233
  merged_ops: list[ops.Operation] = []
231
234
  pending_ops: dict[tuple[cirq.Qid, ...], list[ops.Operation]] = dict()
232
235
  for op in operations:
233
236
  if protocols.num_qubits(op) == 2:
234
- for _, qubit_ops in pending_ops.items():
237
+ for qubit_ops in pending_ops.values():
235
238
  merged_ops.extend(
236
239
  _transform_single_qubit_operations_to_phased_x_and_z(qubit_ops, atol=atol)
237
240
  )
@@ -242,8 +245,10 @@ def _merge_single_qubit_gates(
242
245
  if op.qubits not in pending_ops:
243
246
  pending_ops[op.qubits] = []
244
247
  pending_ops[op.qubits].append(op)
248
+ else:
249
+ raise ValueError(f'operation is on {protocols.num_qubits(op)} qubits, expected 1 or 2')
245
250
  # Merge remaining pending operations
246
- for _, qubit_ops in pending_ops.items():
251
+ for qubit_ops in pending_ops.values():
247
252
  merged_ops.extend(
248
253
  _transform_single_qubit_operations_to_phased_x_and_z(qubit_ops, atol=atol)
249
254
  )
@@ -26,6 +26,7 @@ from cirq.testing import random_two_qubit_circuit_with_czs
26
26
  from cirq.transformers.analytical_decompositions.two_qubit_to_cz import (
27
27
  _is_trivial_angle,
28
28
  _parity_interaction,
29
+ cleanup_operations,
29
30
  two_qubit_matrix_to_diagonal_and_cz_operations,
30
31
  )
31
32
 
@@ -294,3 +295,11 @@ def test_remove_partial_czs_or_fail() -> None:
294
295
  _ = cirq.transformers.analytical_decompositions.two_qubit_to_cz._remove_partial_czs_or_fail(
295
296
  [CZ**-0.5], atol=1e-9
296
297
  )
298
+
299
+
300
+ @pytest.mark.parametrize("gate", [cirq.CCZ, cirq.GlobalPhaseGate(1.0)])
301
+ def test_cleanup_operations_raises_if_op_not_on_1_or_2_qubits(gate: cirq.Gate) -> None:
302
+ qubits = cirq.LineQubit.range(gate.num_qubits())
303
+ op = gate.on(*qubits)
304
+ with pytest.raises(ValueError, match="expected 1 or 2"):
305
+ cleanup_operations([op], atol=1e-8)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cirq-core
3
- Version: 1.6.0.dev20250627024936
3
+ Version: 1.6.0.dev20250627201540
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=iCLIqseK0A4keo0TLJWasfxExqCgf2OjD2jaNQ54Bbc,1206
8
- cirq/_version_test.py,sha256=EBy2CPcW6vrHAl8EdPM4FJlMjt4Q9JHAi4LyjYrGSLY,155
7
+ cirq/_version.py,sha256=1CwcE50eY4ghLp9EN8ksWqG5TMakfgfzQXyoLVekSAg,1206
8
+ cirq/_version_test.py,sha256=eleiwTQXJCb-Q6cWLOThwZo4OeEoB74mQqLc_Tl3Vh8,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
@@ -1112,8 +1112,8 @@ cirq/transformers/analytical_decompositions/three_qubit_decomposition.py,sha256=
1112
1112
  cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py,sha256=a21HU4BE82AG2UJU4hUVqymUU7Lw4CLw4-NChX4OpLI,6808
1113
1113
  cirq/transformers/analytical_decompositions/two_qubit_state_preparation.py,sha256=2bIpZOHBHxH2mdbJfDpo6nQgpitOI0ZmoH_5l_nA1nU,6167
1114
1114
  cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py,sha256=c-vFBZnybd-Ez4rcs13THGGthzEZ0qw9Iw9sAKbE6yc,4494
1115
- cirq/transformers/analytical_decompositions/two_qubit_to_cz.py,sha256=L2ScuiYW5tbNSc9_DJ4S6Lr_0mpmurVKUzlwLmGdJmw,11513
1116
- cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py,sha256=PLPQRsBCVwGCgtL7nBY6xdI_CG1zxTdIj7fFGpxjU2U,10704
1115
+ cirq/transformers/analytical_decompositions/two_qubit_to_cz.py,sha256=bBA8RP-lzv8fKRiHT6M5NEBbl0l_ml5carekhGD5gnU,11705
1116
+ cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py,sha256=eDpkbJqVnSLuqXNJkU1BsaUYSIFRWrUXgQO35xrQHXE,11074
1117
1117
  cirq/transformers/analytical_decompositions/two_qubit_to_fsim.py,sha256=8tYGV41gQBRzJSNUB3bsTMI8vil0TNE4TgqWlEw8BhE,9656
1118
1118
  cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py,sha256=bX8ap8VskN-gKxn3F4A8_vhgWO0AErOpP1QVVEtBjmY,7073
1119
1119
  cirq/transformers/analytical_decompositions/two_qubit_to_ms.py,sha256=dP9umZJBgNJ8FbDFFZVgMSyO-NjWJqXmoWyQuTo--0g,3751
@@ -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.dev20250627024936.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1224
- cirq_core-1.6.0.dev20250627024936.dist-info/METADATA,sha256=H_dxhhia2jGz4_tjl6mDon0lmhRQzs58QRP0xqHhmiU,4857
1225
- cirq_core-1.6.0.dev20250627024936.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1226
- cirq_core-1.6.0.dev20250627024936.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1227
- cirq_core-1.6.0.dev20250627024936.dist-info/RECORD,,
1223
+ cirq_core-1.6.0.dev20250627201540.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1224
+ cirq_core-1.6.0.dev20250627201540.dist-info/METADATA,sha256=qBxAsTgISyFiWKb-RSeARa5-fCVOkqR2K8QEZfgDP2g,4857
1225
+ cirq_core-1.6.0.dev20250627201540.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
1226
+ cirq_core-1.6.0.dev20250627201540.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1227
+ cirq_core-1.6.0.dev20250627201540.dist-info/RECORD,,