cirq-core 1.4.0.dev20240404120310__py3-none-any.whl → 1.4.0.dev20240409210425__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
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev20240404120310"
1
+ __version__ = "1.4.0.dev20240409210425"
cirq/ops/qubit_manager.py CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import abc
16
16
  import dataclasses
17
- from typing import Iterable, List, TYPE_CHECKING
17
+ from typing import Iterable, List, TYPE_CHECKING, Tuple
18
18
  from cirq.ops import raw_types
19
19
 
20
20
  if TYPE_CHECKING:
@@ -41,13 +41,16 @@ class _BaseAncillaQid(raw_types.Qid):
41
41
  dim: int = 2
42
42
  prefix: str = ''
43
43
 
44
- def _comparison_key(self) -> int:
45
- return self.id
44
+ def _comparison_key(self) -> Tuple[str, int]:
45
+ return self.prefix, self.id
46
46
 
47
47
  @property
48
48
  def dimension(self) -> int:
49
49
  return self.dim
50
50
 
51
+ def with_dimension(self, dimension: int) -> '_BaseAncillaQid':
52
+ return dataclasses.replace(self, dim=dimension)
53
+
51
54
  def __repr__(self) -> str:
52
55
  dim_str = f', dim={self.dim}' if self.dim != 2 else ''
53
56
  prefix_str = f', prefix={self.prefix}' if self.prefix != '' else ''
@@ -27,12 +27,23 @@ def test_clean_qubits():
27
27
  q = cqi.CleanQubit(2, dim=3)
28
28
  assert q.id == 2
29
29
  assert q.dimension == 3
30
+ assert q.with_dimension(4) == cqi.CleanQubit(2, dim=4)
30
31
  assert str(q) == '_c(2) (d=3)'
31
32
  assert repr(q) == 'cirq.ops.CleanQubit(2, dim=3)'
32
33
 
33
34
  assert cqi.CleanQubit(1) < cqi.CleanQubit(2)
34
35
 
35
36
 
37
+ def test_ancilla_qubits_prefix():
38
+ assert cqi.CleanQubit(1, prefix="1") != cqi.CleanQubit(1, prefix="2")
39
+ assert cqi.CleanQubit(1, prefix="1") < cqi.CleanQubit(1, prefix="2")
40
+ assert cqi.CleanQubit(1, prefix="1") < cqi.CleanQubit(2, prefix="1")
41
+ assert cqi.BorrowableQubit(1, prefix="1") != cqi.BorrowableQubit(1, prefix="2")
42
+ assert cqi.BorrowableQubit(1, prefix="1") < cqi.BorrowableQubit(1, prefix="2")
43
+ assert cqi.BorrowableQubit(1, prefix="1") < cqi.BorrowableQubit(2, prefix="1")
44
+ assert cqi.CleanQubit(1, prefix="1") != cqi.BorrowableQubit(1, prefix="1")
45
+
46
+
36
47
  def test_borrow_qubits():
37
48
  q = cqi.BorrowableQubit(10)
38
49
  assert q.id == 10
@@ -43,6 +54,7 @@ def test_borrow_qubits():
43
54
  q = cqi.BorrowableQubit(20, dim=4)
44
55
  assert q.id == 20
45
56
  assert q.dimension == 4
57
+ assert q.with_dimension(10) == cqi.BorrowableQubit(20, dim=10)
46
58
  assert str(q) == '_b(20) (d=4)'
47
59
  assert repr(q) == 'cirq.ops.BorrowableQubit(20, dim=4)'
48
60
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.4.0.dev20240404120310
3
+ Version: 1.4.0.dev20240409210425
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
@@ -15,7 +15,7 @@ Requires-Dist: networkx >=2.4
15
15
  Requires-Dist: numpy ~=1.16
16
16
  Requires-Dist: pandas
17
17
  Requires-Dist: sortedcontainers ~=2.0
18
- Requires-Dist: scipy ~=1.12.0
18
+ Requires-Dist: scipy <1.13.0
19
19
  Requires-Dist: sympy
20
20
  Requires-Dist: typing-extensions >=4.2
21
21
  Requires-Dist: tqdm
@@ -4,7 +4,7 @@ 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=8wKYFGb84_VzLngFFabmOAtSwwvIpgY_-B_i5Pab2PE,40
7
+ cirq/_version.py,sha256=5sksXmgtjymQ2Pp1_8AJCmL0D0Un7I-8l9lxRu0UZ2M,40
8
8
  cirq/_version_test.py,sha256=yYS6xm5-nuBRQJa9R3n41WdvFtVyY7Lb5Q8bea3VgBI,133
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=9g_JQMmfBzTuV-3s2flUbXIgcLjs4K7LjAFFgngdG1U,13204
@@ -351,8 +351,8 @@ cirq/ops/projector.py,sha256=isDlNLR8YS5CxsVCihtRAgfKZXFFQxk7kuFXY14t8ys,5690
351
351
  cirq/ops/projector_test.py,sha256=Wq7ddj-PV30yUXJxJoT3XIw2sIUC1AilnZ9m9N5Ejr8,9063
352
352
  cirq/ops/qid_util.py,sha256=IO7vhq5RgeIujO2EhG_FCIvkIMMr2jTyz8gG5M0mrIU,2136
353
353
  cirq/ops/qid_util_test.py,sha256=JdViBgFfH4bZJyPKTjUf9MuPxMQe08JV_Tl6tusekfk,1061
354
- cirq/ops/qubit_manager.py,sha256=EbA8nC00lmi3YMkovSCJjCXYvS_AKIPW-GBzKbUaeyc,3381
355
- cirq/ops/qubit_manager_test.py,sha256=adogGKdWVulCwpByXC_KMP6YNst94R0wuW-5VTEozSk,2351
354
+ cirq/ops/qubit_manager.py,sha256=dGJ1Y-wKUMr7H_chbNDVYDGnU3tRVSPANoTDoE_ULVw,3537
355
+ cirq/ops/qubit_manager_test.py,sha256=HQW78jVq-wLQKznmPmhnKW-xGlnYjAoHaJU78aRnZZk,3062
356
356
  cirq/ops/qubit_order.py,sha256=nYkcMg-y5QtR7M3W1HXq1IWJyMKjrTZXVK1GEbY6gng,5616
357
357
  cirq/ops/qubit_order_or_list.py,sha256=WVnhQcOYCgAhiB4t47Kji-pN1tnvs--X5deCQwwGVno,1165
358
358
  cirq/ops/qubit_order_test.py,sha256=B9xMIxlaI7YjRUNA6AkHJuUCFejGYw-lT7ZaSl31yTU,4238
@@ -1169,8 +1169,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
1169
1169
  cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
1170
1170
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1171
1171
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1172
- cirq_core-1.4.0.dev20240404120310.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1173
- cirq_core-1.4.0.dev20240404120310.dist-info/METADATA,sha256=OQbz_fm4dEgbUbZi_0McqhP9OnhGNRk6txDAmo6TuHs,2099
1174
- cirq_core-1.4.0.dev20240404120310.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1175
- cirq_core-1.4.0.dev20240404120310.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1176
- cirq_core-1.4.0.dev20240404120310.dist-info/RECORD,,
1172
+ cirq_core-1.4.0.dev20240409210425.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1173
+ cirq_core-1.4.0.dev20240409210425.dist-info/METADATA,sha256=64CCo2fgLSzH4dkdF47IIAaYzA-4LPe3iqXKDZJkOIQ,2098
1174
+ cirq_core-1.4.0.dev20240409210425.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1175
+ cirq_core-1.4.0.dev20240409210425.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1176
+ cirq_core-1.4.0.dev20240409210425.dist-info/RECORD,,