cirq-core 1.6.0.dev20250711234653__py3-none-any.whl → 1.6.0.dev20250715173006__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 +1 -1
- cirq/_version_test.py +1 -1
- cirq/circuits/circuit_operation.py +4 -3
- cirq/circuits/circuit_operation_test.py +28 -1
- {cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/RECORD +9 -9
- {cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
|
@@ -29,7 +29,7 @@ import numpy as np
|
|
|
29
29
|
import sympy
|
|
30
30
|
|
|
31
31
|
from cirq import circuits, ops, protocols, study, value
|
|
32
|
-
from cirq._compat import proper_repr
|
|
32
|
+
from cirq._compat import cached_method, proper_repr
|
|
33
33
|
|
|
34
34
|
if TYPE_CHECKING:
|
|
35
35
|
import cirq
|
|
@@ -296,12 +296,13 @@ class CircuitOperation(ops.Operation):
|
|
|
296
296
|
def _is_measurement_(self) -> bool:
|
|
297
297
|
return self.circuit._is_measurement_()
|
|
298
298
|
|
|
299
|
+
@cached_method
|
|
299
300
|
def _has_unitary_(self) -> bool:
|
|
300
301
|
# Return false if parameterized for early exit of has_unitary protocol.
|
|
301
|
-
# Otherwise return NotImplemented instructing the protocol to try alternate strategies
|
|
302
302
|
if self._is_parameterized_() or self.repeat_until:
|
|
303
303
|
return False
|
|
304
|
-
|
|
304
|
+
operations = self._mapped_any_loop.all_operations()
|
|
305
|
+
return all(protocols.has_unitary(op) for op in operations)
|
|
305
306
|
|
|
306
307
|
def _ensure_deterministic_loop_count(self):
|
|
307
308
|
if self.repeat_until or isinstance(self.repetitions, sympy.Expr):
|
|
@@ -22,7 +22,7 @@ import sympy
|
|
|
22
22
|
|
|
23
23
|
import cirq
|
|
24
24
|
import cirq.circuits.circuit_operation as circuit_operation
|
|
25
|
-
from cirq import _compat
|
|
25
|
+
from cirq import _compat, protocols
|
|
26
26
|
from cirq.circuits.circuit_operation import _full_join_string_lists
|
|
27
27
|
|
|
28
28
|
ALL_SIMULATORS = (cirq.Simulator(), cirq.DensityMatrixSimulator(), cirq.CliffordSimulator())
|
|
@@ -1297,3 +1297,30 @@ def test_inner_repeat_until_simulate() -> None:
|
|
|
1297
1297
|
|
|
1298
1298
|
|
|
1299
1299
|
# TODO: Operation has a "gate" property. What is this for a CircuitOperation?
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
def test_has_unitary_protocol_returns_true_if_all_common_gates() -> None:
|
|
1303
|
+
q = cirq.LineQubit(0)
|
|
1304
|
+
op = cirq.CircuitOperation(cirq.FrozenCircuit(cirq.X(q), cirq.Y(q), cirq.Z(q)))
|
|
1305
|
+
assert protocols.has_unitary(op)
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
def test_has_unitary_protocol_returns_false_if_measurement_gate() -> None:
|
|
1309
|
+
q = cirq.LineQubit(0)
|
|
1310
|
+
key = cirq.MeasurementKey('m')
|
|
1311
|
+
op = cirq.CircuitOperation(cirq.FrozenCircuit(cirq.X(q) ** 0.2, cirq.measure(q, key=key)))
|
|
1312
|
+
assert not protocols.has_unitary(op)
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
def test_has_unitary_protocol_returns_false_if_parametrized() -> None:
|
|
1316
|
+
q = cirq.LineQubit(0)
|
|
1317
|
+
exp = sympy.Symbol('exp')
|
|
1318
|
+
op = cirq.CircuitOperation(cirq.FrozenCircuit(cirq.X(q) ** exp))
|
|
1319
|
+
assert not protocols.has_unitary(op)
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
def test_has_unitary_protocol_returns_true_if_all_params_resolve() -> None:
|
|
1323
|
+
q = cirq.LineQubit(0)
|
|
1324
|
+
exp = sympy.Symbol('exp')
|
|
1325
|
+
op = cirq.CircuitOperation(cirq.FrozenCircuit(cirq.X(q) ** exp), param_resolver={exp: 0.5})
|
|
1326
|
+
assert protocols.has_unitary(op)
|
{cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.6.0.
|
|
3
|
+
Version: 1.6.0.dev20250715173006
|
|
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
|
{cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/RECORD
RENAMED
|
@@ -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=
|
|
8
|
-
cirq/_version_test.py,sha256=
|
|
7
|
+
cirq/_version.py,sha256=Rsk_McICa49blgSvRJ13rIyujUXkpjnTfxDnwdk1ydk,1278
|
|
8
|
+
cirq/_version_test.py,sha256=YFBE511iec4hxjEPc66B3ybo016dkwTGgeHsnUuivaM,155
|
|
9
9
|
cirq/conftest.py,sha256=wSDKNdIQRDfLnXvOCWD3erheOw8JHRhdfQ53EyTUIXg,1239
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=hYyG53VJeV61X0oukK5ndZYega8lkL2FyaL1m0j6h5M,13556
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -17,8 +17,8 @@ cirq/circuits/_box_drawing_character_data_test.py,sha256=GyiNQDtiu_drzEe_y8DOXCF
|
|
|
17
17
|
cirq/circuits/_bucket_priority_queue.py,sha256=U564r2mou4aZsOlpVYiZCgirqS6mVznG3ESyawBt4gE,6749
|
|
18
18
|
cirq/circuits/_bucket_priority_queue_test.py,sha256=MOby-UKYZQMe2n4KhqkfDCPrz-T_3eBbWDEa0_nadJQ,5627
|
|
19
19
|
cirq/circuits/circuit.py,sha256=pdRVuMGfCAjoBn5bh01IBR6EoiB8oOtChX_HvI6vBqk,122669
|
|
20
|
-
cirq/circuits/circuit_operation.py,sha256=
|
|
21
|
-
cirq/circuits/circuit_operation_test.py,sha256=
|
|
20
|
+
cirq/circuits/circuit_operation.py,sha256=vvLk30okWhimdJRFhFOpwoHDkyOHzR2I9OIggZaqmVk,36338
|
|
21
|
+
cirq/circuits/circuit_operation_test.py,sha256=ZoYvAIsURx9yPWiLcPeX3--lkCOFJkXLxHafUJaZf1U,50425
|
|
22
22
|
cirq/circuits/circuit_test.py,sha256=Q1ywfvVp6ThmtkAKTk-5bq0cVKctncL0d1qoWxTL_r4,166579
|
|
23
23
|
cirq/circuits/frozen_circuit.py,sha256=UXwABQqBSnSKqSWmRluQPD09xZU0orSW3b3IHvDqxUw,7903
|
|
24
24
|
cirq/circuits/frozen_circuit_test.py,sha256=1Uk3g9St_nJFmu3IJ5hAcXWJjLfWFUXTCKQU1b0JJrE,5321
|
|
@@ -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.
|
|
1224
|
-
cirq_core-1.6.0.
|
|
1225
|
-
cirq_core-1.6.0.
|
|
1226
|
-
cirq_core-1.6.0.
|
|
1227
|
-
cirq_core-1.6.0.
|
|
1223
|
+
cirq_core-1.6.0.dev20250715173006.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1224
|
+
cirq_core-1.6.0.dev20250715173006.dist-info/METADATA,sha256=NeQ_wX5om97ew6s4bLJVlI1KUFIPOUw9qMp-dZPn7uc,4857
|
|
1225
|
+
cirq_core-1.6.0.dev20250715173006.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
1226
|
+
cirq_core-1.6.0.dev20250715173006.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1227
|
+
cirq_core-1.6.0.dev20250715173006.dist-info/RECORD,,
|
{cirq_core-1.6.0.dev20250711234653.dist-info → cirq_core-1.6.0.dev20250715173006.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|