cirq-core 1.7.0.dev20251008130954__py3-none-any.whl → 1.7.0.dev20251010050314__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/ops/gateset.py +20 -1
- {cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/METADATA +1 -1
- {cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/RECORD +8 -8
- {cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/WHEEL +0 -0
- {cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
cirq/ops/gateset.py
CHANGED
|
@@ -340,6 +340,7 @@ class Gateset:
|
|
|
340
340
|
self._unroll_circuit_op = unroll_circuit_op
|
|
341
341
|
self._instance_gate_families: dict[raw_types.Gate, GateFamily] = {}
|
|
342
342
|
self._type_gate_families: dict[type[raw_types.Gate], GateFamily] = {}
|
|
343
|
+
self._gate_families_with_tags: list[GateFamily] = []
|
|
343
344
|
self._gates_repr_str = ", ".join([_gate_str(g, repr) for g in gates])
|
|
344
345
|
unique_gate_list: list[GateFamily] = list(
|
|
345
346
|
dict.fromkeys(g if isinstance(g, GateFamily) else GateFamily(gate=g) for g in gates)
|
|
@@ -351,6 +352,12 @@ class Gateset:
|
|
|
351
352
|
self._instance_gate_families[g.gate] = g
|
|
352
353
|
else:
|
|
353
354
|
self._type_gate_families[g.gate] = g
|
|
355
|
+
else:
|
|
356
|
+
if isinstance(g.gate, raw_types.Gate):
|
|
357
|
+
self._gate_families_with_tags.append(g)
|
|
358
|
+
else:
|
|
359
|
+
# Instance checks are faster, so test them first.
|
|
360
|
+
self._gate_families_with_tags.insert(0, g)
|
|
354
361
|
self._unique_gate_list = unique_gate_list
|
|
355
362
|
self._gates = frozenset(unique_gate_list)
|
|
356
363
|
|
|
@@ -422,6 +429,7 @@ class Gateset:
|
|
|
422
429
|
g = item if isinstance(item, raw_types.Gate) else item.gate
|
|
423
430
|
assert g is not None, f'`item`: {item} must be a gate or have a valid `item.gate`'
|
|
424
431
|
|
|
432
|
+
# Check "type" based GateFamily since isinstance is fast
|
|
425
433
|
for gate_mro_type in type(g).mro():
|
|
426
434
|
if gate_mro_type in self._type_gate_families:
|
|
427
435
|
assert item in self._type_gate_families[gate_mro_type], (
|
|
@@ -430,6 +438,7 @@ class Gateset:
|
|
|
430
438
|
)
|
|
431
439
|
return True
|
|
432
440
|
|
|
441
|
+
# Check exact instance equality next
|
|
433
442
|
if g in self._instance_gate_families:
|
|
434
443
|
assert item in self._instance_gate_families[g], (
|
|
435
444
|
f"{item} instance matches {self._instance_gate_families[g]} but "
|
|
@@ -437,7 +446,17 @@ class Gateset:
|
|
|
437
446
|
)
|
|
438
447
|
return True
|
|
439
448
|
|
|
440
|
-
|
|
449
|
+
# Check other GateFamilies next
|
|
450
|
+
if any(item in gate_family for gate_family in self._gate_families_with_tags):
|
|
451
|
+
return True
|
|
452
|
+
|
|
453
|
+
# Lastly, do a final exhaustive check to make sure this is not equivalent
|
|
454
|
+
# to another type of gate. This will catch things like:
|
|
455
|
+
# cirq.XPowGate(exponent=0) in cirq.GateFamily(cirq.I)
|
|
456
|
+
return any(
|
|
457
|
+
item in gate_family
|
|
458
|
+
for gate_family in self._gates.difference(self._gate_families_with_tags)
|
|
459
|
+
)
|
|
441
460
|
|
|
442
461
|
def validate(self, circuit_or_optree: cirq.AbstractCircuit | op_tree.OP_TREE) -> bool:
|
|
443
462
|
"""Validates gates forming `circuit_or_optree` should be contained in Gateset.
|
{cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.7.0.
|
|
3
|
+
Version: 1.7.0.dev20251010050314
|
|
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.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/RECORD
RENAMED
|
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=emXpdD5ZvwLRlFAoQB8YatmZyU3b4e9jg6FppMTUhkU,33900
|
|
|
4
4
|
cirq/_doc.py,sha256=28ZskY9ZtZ_4GS1oXPUgklKnJqmAE-rkUfzcsJ0--nA,2941
|
|
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=MQm9E-NLtugcD9Nos3y39OQXJuOUQaS9QM0N5OX9kQ0,1206
|
|
8
|
+
cirq/_version_test.py,sha256=_d9LKzvKr6sL16Rvz2V-x8x_Qzh5Os-1YG3l-7e0OrM,155
|
|
9
9
|
cirq/conftest.py,sha256=wSDKNdIQRDfLnXvOCWD3erheOw8JHRhdfQ53EyTUIXg,1239
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=A5DIgFAY1hUNt9vai_C3-gGBv24116CJMzQxMcXOax4,13726
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -322,7 +322,7 @@ cirq/ops/gate_features.py,sha256=OfjsIGftnGpNUDAYwSP4obG0FsMrHYfp49ZOjbvbmNE,108
|
|
|
322
322
|
cirq/ops/gate_features_test.py,sha256=JYPunTBr48CQoIOB1wk2QEdPwtnmE-FxUoF6a4ZeRB8,2407
|
|
323
323
|
cirq/ops/gate_operation.py,sha256=tyQOHZ_A_kGy6Yzn1fDTkHBNyzyvPmxbnueG6e5yOGM,13632
|
|
324
324
|
cirq/ops/gate_operation_test.py,sha256=4QwWxCjGXNM__6QGw1kYSbBMh_4783jBZVBJD1ERGPk,18020
|
|
325
|
-
cirq/ops/gateset.py,sha256=
|
|
325
|
+
cirq/ops/gateset.py,sha256=oJVaCZXk0bZGMitLrvWF9aa2GNPuvthvBS8sqsogoA0,22681
|
|
326
326
|
cirq/ops/gateset_test.py,sha256=oeJ0zLgknWxgW39_bc_8Ii_5_g5VNxiJWicZkkS-TaE,17651
|
|
327
327
|
cirq/ops/global_phase_op.py,sha256=GcERs4X5h5_at6tvJc8-AcM0cVsLCRPlpPkAWMINm54,5711
|
|
328
328
|
cirq/ops/global_phase_op_test.py,sha256=9BBnPZLLmBzHsMoRPMFTAShx87TJnhTLvvgLpHJF4wc,10721
|
|
@@ -1244,8 +1244,8 @@ cirq/work/sampler.py,sha256=rxbMWvrhu3gfNSBjZKozw28lLKVvBAS_1EGyPdYe8Xg,19041
|
|
|
1244
1244
|
cirq/work/sampler_test.py,sha256=SsMrRvLDYELyOAWLKISjkdEfrBwLYWRsT6D8WrsLM3Q,13533
|
|
1245
1245
|
cirq/work/zeros_sampler.py,sha256=Fs2JWwq0n9zv7_G5Rm-9vPeHUag7uctcMOHg0JTkZpc,2371
|
|
1246
1246
|
cirq/work/zeros_sampler_test.py,sha256=lQLgQDGBLtfImryys2HzQ2jOSGxHgc7-koVBUhv8qYk,3345
|
|
1247
|
-
cirq_core-1.7.0.
|
|
1248
|
-
cirq_core-1.7.0.
|
|
1249
|
-
cirq_core-1.7.0.
|
|
1250
|
-
cirq_core-1.7.0.
|
|
1251
|
-
cirq_core-1.7.0.
|
|
1247
|
+
cirq_core-1.7.0.dev20251010050314.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1248
|
+
cirq_core-1.7.0.dev20251010050314.dist-info/METADATA,sha256=-CvUwMGq4M9e05EOyiGRGl-6DiMuoe8e0Z8b-z0_k8g,4757
|
|
1249
|
+
cirq_core-1.7.0.dev20251010050314.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
1250
|
+
cirq_core-1.7.0.dev20251010050314.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1251
|
+
cirq_core-1.7.0.dev20251010050314.dist-info/RECORD,,
|
{cirq_core-1.7.0.dev20251008130954.dist-info → cirq_core-1.7.0.dev20251010050314.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|