cirq-core 1.4.0.dev20231219053110__py3-none-any.whl → 1.4.0.dev20231220031403__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.dev20231219053110"
1
+ __version__ = "1.4.0.dev20231220031403"
cirq/circuits/circuit.py CHANGED
@@ -29,14 +29,14 @@ from typing import (
29
29
  AbstractSet,
30
30
  Any,
31
31
  Callable,
32
- Mapping,
33
- MutableSequence,
34
32
  cast,
35
33
  Dict,
36
34
  FrozenSet,
37
35
  Iterable,
38
36
  Iterator,
39
37
  List,
38
+ Mapping,
39
+ MutableSequence,
40
40
  Optional,
41
41
  overload,
42
42
  Sequence,
@@ -58,9 +58,9 @@ from cirq._doc import document
58
58
  from cirq.circuits._bucket_priority_queue import BucketPriorityQueue
59
59
  from cirq.circuits.circuit_operation import CircuitOperation
60
60
  from cirq.circuits.insert_strategy import InsertStrategy
61
+ from cirq.circuits.moment import Moment
61
62
  from cirq.circuits.qasm_output import QasmOutput
62
63
  from cirq.circuits.text_diagram_drawer import TextDiagramDrawer
63
- from cirq.circuits.moment import Moment
64
64
  from cirq.protocols import circuit_diagram_info_protocol
65
65
  from cirq.type_workarounds import NotImplementedType
66
66
 
@@ -203,19 +203,24 @@ class AbstractCircuit(abc.ABC):
203
203
  copy: If True and 'self' is a Circuit, returns a copy that circuit.
204
204
  """
205
205
 
206
- def __bool__(self):
206
+ def __bool__(self) -> bool:
207
207
  return bool(self.moments)
208
208
 
209
- def __eq__(self, other):
209
+ def __eq__(self, other) -> bool:
210
210
  if not isinstance(other, AbstractCircuit):
211
211
  return NotImplemented
212
- return tuple(self.moments) == tuple(other.moments)
212
+ return other is self or (
213
+ len(self.moments) == len(other.moments)
214
+ and all(m0 == m1 for m0, m1 in zip(self.moments, other.moments))
215
+ )
213
216
 
214
217
  def _approx_eq_(self, other: Any, atol: Union[int, float]) -> bool:
215
218
  """See `cirq.protocols.SupportsApproximateEquality`."""
216
219
  if not isinstance(other, AbstractCircuit):
217
220
  return NotImplemented
218
- return cirq.protocols.approx_eq(tuple(self.moments), tuple(other.moments), atol=atol)
221
+ return other is self or cirq.protocols.approx_eq(
222
+ tuple(self.moments), tuple(other.moments), atol=atol
223
+ )
219
224
 
220
225
  def __ne__(self, other) -> bool:
221
226
  return not self == other
cirq/ops/pauli_gates.py CHANGED
@@ -15,6 +15,7 @@ import abc
15
15
  from typing import Any, cast, Tuple, TYPE_CHECKING, Union, Dict
16
16
 
17
17
  from cirq._doc import document
18
+ from cirq._import import LazyLoader
18
19
  from cirq.ops import common_gates, raw_types, identity
19
20
  from cirq.type_workarounds import NotImplementedType
20
21
 
@@ -29,6 +30,9 @@ if TYPE_CHECKING:
29
30
  ) # pragma: no cover
30
31
 
31
32
 
33
+ pauli_string = LazyLoader("pauli_string", globals(), "cirq.ops.pauli_string")
34
+
35
+
32
36
  class Pauli(raw_types.Gate, metaclass=abc.ABCMeta):
33
37
  """Represents the Pauli gates.
34
38
 
@@ -97,9 +101,8 @@ class Pauli(raw_types.Gate, metaclass=abc.ABCMeta):
97
101
  """
98
102
  if len(qubits) != 1:
99
103
  raise ValueError(f'Expected a single qubit, got <{qubits!r}>.')
100
- from cirq.ops.pauli_string import SingleQubitPauliStringGateOperation
101
104
 
102
- return SingleQubitPauliStringGateOperation(self, qubits[0])
105
+ return pauli_string.SingleQubitPauliStringGateOperation(self, qubits[0])
103
106
 
104
107
  @property
105
108
  def _canonical_exponent(self):
cirq/ops/pauli_string.py CHANGED
@@ -42,7 +42,7 @@ import numpy as np
42
42
  import sympy
43
43
 
44
44
  import cirq
45
- from cirq import value, protocols, linalg, qis
45
+ from cirq import value, protocols, linalg, qis, _compat
46
46
  from cirq._doc import document
47
47
  from cirq._import import LazyLoader
48
48
  from cirq.ops import (
@@ -184,7 +184,7 @@ class PauliString(raw_types.Operation, Generic[TKey]):
184
184
  Raises:
185
185
  TypeError: If the `qubit_pauli_map` has values that are not Paulis.
186
186
  """
187
- if qubit_pauli_map is not None:
187
+ if _compat.__cirq_debug__.get() and qubit_pauli_map is not None:
188
188
  for v in qubit_pauli_map.values():
189
189
  if not isinstance(v, pauli_gates.Pauli):
190
190
  raise TypeError(f'{v} is not a Pauli')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.4.0.dev20231219053110
3
+ Version: 1.4.0.dev20231220031403
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=iQJYqIP1uyRe8mNUwi2VKccyUaJDFYH7b3Fg6cqQLQw,35053
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=tNoN50wPzecPRMEg16yKtNQvO_FPI41eBv3NuvJ1ZIQ,40
7
+ cirq/_version.py,sha256=YwBbJgtb3-L53mlejApd8WL8by1eDdpIYGOfFQE8u7I,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=S0HaPOCUIck-vNSQlS6KxnQtle6w-2dGuSxkUbJQY9Y,13168
@@ -17,7 +17,7 @@ cirq/circuits/_box_drawing_character_data.py,sha256=QLoCXwcLL7091RdxEKO259goxt4R
17
17
  cirq/circuits/_box_drawing_character_data_test.py,sha256=XO94z0piwZRHaNZHTf-5tKHQ4MKcDruMeRIKdT8GbYA,1624
18
18
  cirq/circuits/_bucket_priority_queue.py,sha256=hxFuii2fKD8G6EKT_aVLEsA7FmSfqFXPwIbA0KsoSC4,6745
19
19
  cirq/circuits/_bucket_priority_queue_test.py,sha256=t6u_hG7K2e2WKWrgCsKxNRtp4ghKwiCrp0_WSY0W25k,5288
20
- cirq/circuits/circuit.py,sha256=9if8V9V5PU7oR6jUi9YHeP2uSGdFZ-F0qJdFnbMxOKY,114214
20
+ cirq/circuits/circuit.py,sha256=KP6tYjQ4pb1kz_jW3cfCgtnVvN_MRl0jHeNsOq0CA70,114383
21
21
  cirq/circuits/circuit_operation.py,sha256=qdJshRvGRFKwin7Ec_RndIb2Fm3sh7-N9SarEZo6AXM,34354
22
22
  cirq/circuits/circuit_operation_test.py,sha256=_0iQJ3h_dnQcQmbGRZbc-NqdglJTXantbj72ggqLKNE,44724
23
23
  cirq/circuits/circuit_test.py,sha256=EYIApq2DpZe7HckvySR3JlJdUIfJTSbKHm0lgENP2HA,160111
@@ -323,13 +323,13 @@ cirq/ops/parallel_gate.py,sha256=RSj1SuiwbDCMWxvTmi3xz7oE2QXBFgA59emijh4JPkE,633
323
323
  cirq/ops/parallel_gate_test.py,sha256=M6o3AyXFQrwyiOTtGxlYH09TbHdjtTxCuMjmn-ALnn0,6298
324
324
  cirq/ops/parity_gates.py,sha256=JJdw_A9HHiJFVlYfWxp0QPBXtgfHjQYbYH_YFjoU4K4,14208
325
325
  cirq/ops/parity_gates_test.py,sha256=-Ib4GO4njRHanuTMpGvz_zaQf0siUJNNd_tpEYKUOjg,11462
326
- cirq/ops/pauli_gates.py,sha256=Bya7Qh4QiSeoh3OlTQ8bYvh4-Pwg17TMBxoqMrmdrlw,6933
326
+ cirq/ops/pauli_gates.py,sha256=sqqQEKEU89cmb1pzLPnrZ5XC0LchSXid8tHLQs8xJnk,6984
327
327
  cirq/ops/pauli_gates_test.py,sha256=bHt7A2w0auWxN9gyKAVeimT1KeOHz5C_CjFHSK1V-Co,7752
328
328
  cirq/ops/pauli_interaction_gate.py,sha256=GQtK5lRw2Uh7hs2GsoRxe-VMlMTO8PxDeZNVT6_qOWI,5499
329
329
  cirq/ops/pauli_interaction_gate_test.py,sha256=U9ORW5Ayx5PESPFiGESzWY-02qHklYcM1mYW56RWe_A,4544
330
330
  cirq/ops/pauli_measurement_gate.py,sha256=tq_OlHlTLQa6yah--afE2UMNdF4a_vfXi8XT8ww2ELc,7215
331
331
  cirq/ops/pauli_measurement_gate_test.py,sha256=uh3J0Ps3V3578V8qkRiEgIl6jBiv8DsXlk_vzLvOEhQ,6720
332
- cirq/ops/pauli_string.py,sha256=RIVNQ-HO0HYUbfGuTZoIJPoGUZuWb-8msFeOucN5CY4,66564
332
+ cirq/ops/pauli_string.py,sha256=HsiSe2fdwE1aodB3CmGahAAzjvcQDxmC9V8R6BbmhGU,66606
333
333
  cirq/ops/pauli_string_phasor.py,sha256=F1Gftw8TDb9qdJjQti6xxbOpXbFUFCVwn3r8073wRbY,17604
334
334
  cirq/ops/pauli_string_phasor_test.py,sha256=HGEPjPc7ySeshOnMJHNjtyckFuEXLvxgy-TtnU6fETM,27582
335
335
  cirq/ops/pauli_string_raw_types.py,sha256=6CgdPWYmOziP4uZbrIsRW0sDSMmV1GioGdAk0owFITU,2240
@@ -1148,8 +1148,8 @@ cirq/work/sampler.py,sha256=JVv1vvfa6EgFiR3UeDk44U186dCrioH2NZXueCgsb9w,19828
1148
1148
  cirq/work/sampler_test.py,sha256=zo1Hj6sn6fLs_WZMxYRApBqgBsldmptn74NL0jhNukc,12325
1149
1149
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1150
1150
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1151
- cirq_core-1.4.0.dev20231219053110.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1152
- cirq_core-1.4.0.dev20231219053110.dist-info/METADATA,sha256=J66iEVVGkGcOti6Tolkyp3GQz4ZqZpWxLzQC5gpGlhE,2075
1153
- cirq_core-1.4.0.dev20231219053110.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
1154
- cirq_core-1.4.0.dev20231219053110.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1155
- cirq_core-1.4.0.dev20231219053110.dist-info/RECORD,,
1151
+ cirq_core-1.4.0.dev20231220031403.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1152
+ cirq_core-1.4.0.dev20231220031403.dist-info/METADATA,sha256=DqMolVwVykRju41uCQoWz70ThaiR35qKn3JqgfTNHzw,2075
1153
+ cirq_core-1.4.0.dev20231220031403.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
1154
+ cirq_core-1.4.0.dev20231220031403.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1155
+ cirq_core-1.4.0.dev20231220031403.dist-info/RECORD,,