cirq-core 1.3.0.dev20230830204857__py3-none-any.whl → 1.3.0.dev20230906203935__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.3.0.dev20230830204857"
1
+ __version__ = "1.3.0.dev20230906203935"
@@ -570,6 +570,9 @@ class MutableDensePauliString(BaseDensePauliString):
570
570
  def __str__(self) -> str:
571
571
  return super().__str__() + ' (mutable)'
572
572
 
573
+ def _value_equality_values_(self):
574
+ return self.coefficient, tuple(PAULI_CHARS[p] for p in self.pauli_mask)
575
+
573
576
  @classmethod
574
577
  def inline_gaussian_elimination(cls, rows: 'List[MutableDensePauliString]') -> None:
575
578
  if not rows:
@@ -357,7 +357,7 @@ def _pauli_string_from_unit(unit: UnitPauliStringT, coefficient: Union[int, floa
357
357
  return PauliString(qubit_pauli_map=dict(unit), coefficient=coefficient)
358
358
 
359
359
 
360
- @value.value_equality(approximate=True)
360
+ @value.value_equality(approximate=True, unhashable=True)
361
361
  class PauliSum:
362
362
  """Represents operator defined by linear combination of PauliStrings.
363
363
 
@@ -17,7 +17,7 @@ from typing import Any, Callable, Optional, overload, Union
17
17
 
18
18
  from typing_extensions import Protocol
19
19
 
20
- from cirq import protocols
20
+ from cirq import protocols, _compat
21
21
 
22
22
 
23
23
  class _SupportsValueEquality(Protocol):
@@ -221,13 +221,21 @@ def value_equality(
221
221
  )
222
222
  else:
223
223
  setattr(cls, '_value_equality_values_cls_', lambda self: cls)
224
- setattr(cls, '__hash__', None if unhashable else _value_equality_hash)
224
+ cached_values_getter = values_getter if unhashable else _compat.cached_method(values_getter)
225
+ setattr(cls, '_value_equality_values_', cached_values_getter)
226
+ setattr(cls, '__hash__', None if unhashable else _compat.cached_method(_value_equality_hash))
225
227
  setattr(cls, '__eq__', _value_equality_eq)
226
228
  setattr(cls, '__ne__', _value_equality_ne)
227
229
 
228
230
  if approximate:
229
231
  if not hasattr(cls, '_value_equality_approximate_values_'):
230
- setattr(cls, '_value_equality_approximate_values_', values_getter)
232
+ setattr(cls, '_value_equality_approximate_values_', cached_values_getter)
233
+ else:
234
+ approx_values_getter = getattr(cls, '_value_equality_approximate_values_')
235
+ cached_approx_values_getter = (
236
+ approx_values_getter if unhashable else _compat.cached_method(approx_values_getter)
237
+ )
238
+ setattr(cls, '_value_equality_approximate_values_', cached_approx_values_getter)
231
239
  setattr(cls, '_approx_eq_', _value_equality_approx_eq)
232
240
 
233
241
  return cls
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.3.0.dev20230830204857
3
+ Version: 1.3.0.dev20230906203935
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,7 +4,7 @@ cirq/_compat_test.py,sha256=84X6ELsb5fv3Hc0_ly8-IQfMnCNQN6tHs6GZFrnuNyI,35005
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=H5X9pq6MiC4Dc5yElQnPdWltplT_jjFMG9LPSE1UUk4,40
7
+ cirq/_version.py,sha256=Lph21tovu5S2bADiAHughP1Hxs0kRbVO617VJbFo_Rs,40
8
8
  cirq/_version_test.py,sha256=Ea3ZNdQKZBsZrSc9xle7TUdT9bUINs-qezPruQ_m38s,133
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=JJiO1dhHsEqYClUv68eg-hiOzbb_C1QiQ-BCcvoe4Ck,13067
@@ -281,7 +281,7 @@ cirq/ops/controlled_gate.py,sha256=uVTZk6pA1ZpEwbVggLeXyAFq18_QJ38hWYhk9GbvQnc,1
281
281
  cirq/ops/controlled_gate_test.py,sha256=5sUUV0xng-GpQOTSiyQqB_LBaTeXXqHehqQuvvw7Cf4,23113
282
282
  cirq/ops/controlled_operation.py,sha256=sbT1PGUQjV8a014e8TOeZY2N1q6QXF4n0RVJswBtOX0,14014
283
283
  cirq/ops/controlled_operation_test.py,sha256=ioAq2we54vDPAf6ttoUPLWqt1nQzLmkcQ9GQRL60t88,16459
284
- cirq/ops/dense_pauli_string.py,sha256=_Hh8D04nM0j2D9q1dMxvII2DE5oVQTjUfJ_M6M1t5T8,24405
284
+ cirq/ops/dense_pauli_string.py,sha256=SPrNsgeC2-ETqD2wbZ7R7lOltIUWITqBUHH02dVaMzA,24525
285
285
  cirq/ops/dense_pauli_string_test.py,sha256=duvgzhgTV9wuem4kDSwtL62SEUCThkz1tdP984-C4_s,21504
286
286
  cirq/ops/diagonal_gate.py,sha256=W_yXf4qZY_AeP32VN-0u4lS0-WsqjWTg2VSABaO06Wk,9024
287
287
  cirq/ops/diagonal_gate_test.py,sha256=cPHxjc7g2oTcXt5UFm470oo0eJupubSNzs4TccKHlSc,6223
@@ -303,7 +303,7 @@ cirq/ops/identity.py,sha256=4H67nV4i85wi3HWY-k5ImC9hX9U6BjIZp61JalHpsTI,5503
303
303
  cirq/ops/identity_test.py,sha256=dGx9nzeFCoVo3SmlEbqCGJT1XyzJh-qoPl9n2gEd9WQ,7422
304
304
  cirq/ops/kraus_channel.py,sha256=tCPAEzr_GAL5vTwI43rBoiOnT04l-ebZanuuEuYWDo8,5085
305
305
  cirq/ops/kraus_channel_test.py,sha256=qH2Y9cngXzKCabd-Mq5xBYcM_wyL8c6KkrXw8kZr7Dc,4726
306
- cirq/ops/linear_combinations.py,sha256=VrPwMSeOI9UGcWZCS0MptXOlECp1w0ZGo3OpahQnQaY,39651
306
+ cirq/ops/linear_combinations.py,sha256=1BynexPtrNc26McHXv3rErh6NYGzcxNqXWyWJ11ugDw,39668
307
307
  cirq/ops/linear_combinations_test.py,sha256=qpzRo53mJtcidYE11loKMP2b9guKMGtzrKWQ_u0jr4Y,66387
308
308
  cirq/ops/matrix_gates.py,sha256=8ARvpHWYFgwmlT99-Gxoa24i_mxKLvdj_RhoQvglKQw,9290
309
309
  cirq/ops/matrix_gates_test.py,sha256=m5rMwq_sqVvsmkc5opVr3Ikd1ERuULmSRNAvGZUg7ds,14224
@@ -1108,7 +1108,7 @@ cirq/value/random_state_test.py,sha256=0VyxtuBYgrbHsNCXFZtcgucd5KwI1obMjILH2ZTZ5
1108
1108
  cirq/value/timestamp.py,sha256=u0v5FmnSF_o3NE7aF-xIfQ5cDAVZzaUb-ZMdrxWYg2Y,3649
1109
1109
  cirq/value/timestamp_test.py,sha256=eZt9LLVK6TQy-2Bo1djitUD4at7i7M4lN60bLCx9UPs,4029
1110
1110
  cirq/value/type_alias.py,sha256=YD5m-77rx-hatIEVi5Q5j5tZ2Ji3Mmg4jUY9GT3LscM,1144
1111
- cirq/value/value_equality_attr.py,sha256=DuxmEdTAg4SsauOKoVNWpXUUnaYHeZa9YhvWKZsrQyM,9494
1111
+ cirq/value/value_equality_attr.py,sha256=JX5urKm22YUi7xIc55foyhov8wSkHqwEHQh5sfbuAuw,10048
1112
1112
  cirq/value/value_equality_attr_test.py,sha256=k_nl5hWxo4yMO6WNu0wU68wyeb-RN9Ua_Ix7s9UTfOE,6412
1113
1113
  cirq/vis/__init__.py,sha256=e3Z1PI-Ay0hDHhIgFZEDwQIuO8C_aayNdL-EByF0J4o,1001
1114
1114
  cirq/vis/density_matrix.py,sha256=kMAPcRh6f0ghZKSe86nB_2iFngrDsw0pNael1EZ5BEw,4819
@@ -1140,8 +1140,8 @@ cirq/work/sampler.py,sha256=JVv1vvfa6EgFiR3UeDk44U186dCrioH2NZXueCgsb9w,19828
1140
1140
  cirq/work/sampler_test.py,sha256=zo1Hj6sn6fLs_WZMxYRApBqgBsldmptn74NL0jhNukc,12325
1141
1141
  cirq/work/zeros_sampler.py,sha256=D3hbNZC-jXKuNAWg2OUiUuT8pmDV_WFnEfMank6In4o,2357
1142
1142
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1143
- cirq_core-1.3.0.dev20230830204857.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1144
- cirq_core-1.3.0.dev20230830204857.dist-info/METADATA,sha256=eBoRKAyBKVUsOgiM4y-9YOxauQXPxg3CCHs_tpyhg6w,2077
1145
- cirq_core-1.3.0.dev20230830204857.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
1146
- cirq_core-1.3.0.dev20230830204857.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1147
- cirq_core-1.3.0.dev20230830204857.dist-info/RECORD,,
1143
+ cirq_core-1.3.0.dev20230906203935.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1144
+ cirq_core-1.3.0.dev20230906203935.dist-info/METADATA,sha256=q3Mz6DKYHn0XloRP1gc90t2lJY9b9eg8aXrva9DdSsQ,2077
1145
+ cirq_core-1.3.0.dev20230906203935.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
1146
+ cirq_core-1.3.0.dev20230906203935.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1147
+ cirq_core-1.3.0.dev20230906203935.dist-info/RECORD,,