cirq-core 1.4.0.dev20240316035406__py3-none-any.whl → 1.4.0.dev20240318170608__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/transformers/transformer_primitives.py +3 -6
- cirq/transformers/transformer_primitives_test.py +27 -0
- {cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/METADATA +1 -1
- {cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/RECORD +8 -8
- {cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/LICENSE +0 -0
- {cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/WHEEL +0 -0
- {cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.4.0.
|
|
1
|
+
__version__ = "1.4.0.dev20240318170608"
|
|
@@ -53,12 +53,9 @@ def _to_target_circuit_type(
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def _create_target_circuit_type(ops: ops.OP_TREE, target_circuit: CIRCUIT_TYPE) -> CIRCUIT_TYPE:
|
|
56
|
-
|
|
57
|
-
CIRCUIT_TYPE,
|
|
58
|
-
|
|
59
|
-
if isinstance(target_circuit, circuits.Circuit)
|
|
60
|
-
else circuits.FrozenCircuit(ops),
|
|
61
|
-
)
|
|
56
|
+
if isinstance(target_circuit, circuits.FrozenCircuit):
|
|
57
|
+
return cast(CIRCUIT_TYPE, circuits.FrozenCircuit(ops).with_tags(*target_circuit.tags))
|
|
58
|
+
return cast(CIRCUIT_TYPE, circuits.Circuit(ops))
|
|
62
59
|
|
|
63
60
|
|
|
64
61
|
def map_moments(
|
|
@@ -205,6 +205,33 @@ def test_map_operations_deep_subcircuits():
|
|
|
205
205
|
# pylint: enable=line-too-long
|
|
206
206
|
|
|
207
207
|
|
|
208
|
+
@pytest.mark.parametrize("deep", [False, True])
|
|
209
|
+
def test_map_operations_preserves_circuit_tags(deep: bool) -> None:
|
|
210
|
+
tag = "should be preserved"
|
|
211
|
+
|
|
212
|
+
def func(op: cirq.Operation, idx: int) -> cirq.Operation:
|
|
213
|
+
return cirq.Y(op.qubits[0]) if op.gate == cirq.X else op
|
|
214
|
+
|
|
215
|
+
x = cirq.X(cirq.q(0))
|
|
216
|
+
circuit = cirq.FrozenCircuit.from_moments(x, cirq.FrozenCircuit(x)).with_tags(tag)
|
|
217
|
+
mapped = cirq.map_operations(circuit, func, deep=deep)
|
|
218
|
+
|
|
219
|
+
assert mapped.tags == (tag,)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_map_operations_deep_preserves_subcircuit_tags():
|
|
223
|
+
tag = "should be preserved"
|
|
224
|
+
|
|
225
|
+
def func(op: cirq.Operation, idx: int) -> cirq.Operation:
|
|
226
|
+
return cirq.Y(op.qubits[0]) if op.gate == cirq.X else op
|
|
227
|
+
|
|
228
|
+
x = cirq.X(cirq.q(0))
|
|
229
|
+
circuit = cirq.FrozenCircuit.from_moments(x, cirq.FrozenCircuit(x).with_tags(tag))
|
|
230
|
+
mapped = cirq.map_operations(circuit, func, deep=True)
|
|
231
|
+
|
|
232
|
+
assert mapped[1].operations[0].circuit.tags == (tag,)
|
|
233
|
+
|
|
234
|
+
|
|
208
235
|
def test_map_operations_deep_respects_tags_to_ignore():
|
|
209
236
|
q = cirq.LineQubit.range(2)
|
|
210
237
|
c_nested = cirq.FrozenCircuit(cirq.CX(*q), cirq.CX(*q).with_tags("ignore"), cirq.CX(*q))
|
{cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev20240318170608
|
|
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.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/RECORD
RENAMED
|
@@ -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=
|
|
7
|
+
cirq/_version.py,sha256=IP9DCUnAKpWQbKEXBra8_ck6RKP0bPH7OII1n5QGDL8,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
|
|
@@ -1042,8 +1042,8 @@ cirq/transformers/synchronize_terminal_measurements.py,sha256=p061MYYglY6HhWYYkF
|
|
|
1042
1042
|
cirq/transformers/synchronize_terminal_measurements_test.py,sha256=VTiw5S3s_Y31qR7ME8Mzv50LdJ_6M3DOtgwvtziQzPI,7742
|
|
1043
1043
|
cirq/transformers/transformer_api.py,sha256=beDdouAulWeg4SQRwAjgc5H1jrKD0maYY32XczsHokI,16964
|
|
1044
1044
|
cirq/transformers/transformer_api_test.py,sha256=f-Vup0VCUvTqJKm5kWHf6xet7sFTerLMGYzJHy8Rc5s,13045
|
|
1045
|
-
cirq/transformers/transformer_primitives.py,sha256=
|
|
1046
|
-
cirq/transformers/transformer_primitives_test.py,sha256=
|
|
1045
|
+
cirq/transformers/transformer_primitives.py,sha256=tINAM7D7_MN9QzXwa7_BJkZ6ThcfYLxolbSsQQx2oM0,37578
|
|
1046
|
+
cirq/transformers/transformer_primitives_test.py,sha256=TwznpAZpJue9gE1sRQAl_0n6YyXTimckgGy4-2YrEvY,42256
|
|
1047
1047
|
cirq/transformers/analytical_decompositions/__init__.py,sha256=ZNtETntol3G_n6uqzGxOmBanGMbCj0QAc-5vicN2jkM,2724
|
|
1048
1048
|
cirq/transformers/analytical_decompositions/clifford_decomposition.py,sha256=DsuuP91pm2dX0CO4rWwmJAJyAfuXMcA1UJK0g8krp7k,6726
|
|
1049
1049
|
cirq/transformers/analytical_decompositions/clifford_decomposition_test.py,sha256=AAZh_9vEb5f2E_EItPZTlMRNdv0d47AwqTn4BytX0UI,7102
|
|
@@ -1154,8 +1154,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
|
|
|
1154
1154
|
cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
|
|
1155
1155
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1156
1156
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1157
|
-
cirq_core-1.4.0.
|
|
1158
|
-
cirq_core-1.4.0.
|
|
1159
|
-
cirq_core-1.4.0.
|
|
1160
|
-
cirq_core-1.4.0.
|
|
1161
|
-
cirq_core-1.4.0.
|
|
1157
|
+
cirq_core-1.4.0.dev20240318170608.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1158
|
+
cirq_core-1.4.0.dev20240318170608.dist-info/METADATA,sha256=9LlNx-yxMHX68BtN6ge8WxHkurWmdK7I1u4F4lAWbWA,2090
|
|
1159
|
+
cirq_core-1.4.0.dev20240318170608.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
1160
|
+
cirq_core-1.4.0.dev20240318170608.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1161
|
+
cirq_core-1.4.0.dev20240318170608.dist-info/RECORD,,
|
{cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.4.0.dev20240316035406.dist-info → cirq_core-1.4.0.dev20240318170608.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|