cirq-core 1.6.0.dev20250616231428__py3-none-any.whl → 1.6.0.dev20250617175947__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.
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/transformers/merge_single_qubit_gates.py +5 -1
- cirq/transformers/merge_single_qubit_gates_test.py +32 -0
- {cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/RECORD +9 -9
- {cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
|
@@ -118,7 +118,7 @@ def merge_single_qubit_moments_to_phxz(
|
|
|
118
118
|
|
|
119
119
|
def can_merge_moment(m: cirq.Moment):
|
|
120
120
|
return all(
|
|
121
|
-
protocols.num_qubits(op)
|
|
121
|
+
protocols.num_qubits(op) <= 1
|
|
122
122
|
and protocols.has_unitary(op)
|
|
123
123
|
and tags_to_ignore.isdisjoint(op.tags)
|
|
124
124
|
for op in m
|
|
@@ -146,6 +146,10 @@ def merge_single_qubit_moments_to_phxz(
|
|
|
146
146
|
)
|
|
147
147
|
if gate:
|
|
148
148
|
ret_ops.append(gate(q))
|
|
149
|
+
# Transfer global phase
|
|
150
|
+
for op in m1.operations + m2.operations:
|
|
151
|
+
if protocols.num_qubits(op) == 0:
|
|
152
|
+
ret_ops.append(op)
|
|
149
153
|
return circuits.Moment(ret_ops)
|
|
150
154
|
|
|
151
155
|
return transformer_primitives.merge_moments(
|
|
@@ -231,3 +231,35 @@ def test_merge_single_qubit_gates_to_phased_x_and_z_global_phase():
|
|
|
231
231
|
c = cirq.Circuit(cirq.GlobalPhaseGate(1j).on())
|
|
232
232
|
c2 = cirq.merge_single_qubit_gates_to_phased_x_and_z(c)
|
|
233
233
|
assert c == c2
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def test_merge_single_qubit_moments_to_phxz_with_global_phase_in_first_moment():
|
|
237
|
+
q0 = cirq.LineQubit(0)
|
|
238
|
+
c_orig = cirq.Circuit(
|
|
239
|
+
cirq.Moment(cirq.Y(q0) ** 0.5, cirq.GlobalPhaseGate(1j**0.5).on()), cirq.Moment(cirq.X(q0))
|
|
240
|
+
)
|
|
241
|
+
c_expected = cirq.Circuit(
|
|
242
|
+
cirq.Moment(
|
|
243
|
+
cirq.PhasedXZGate(axis_phase_exponent=-0.5, x_exponent=0.5, z_exponent=-1.0).on(q0),
|
|
244
|
+
cirq.GlobalPhaseGate(1j**0.5).on(),
|
|
245
|
+
)
|
|
246
|
+
)
|
|
247
|
+
context = cirq.TransformerContext(tags_to_ignore=["ignore"])
|
|
248
|
+
c_new = cirq.merge_single_qubit_moments_to_phxz(c_orig, context=context)
|
|
249
|
+
assert c_new == c_expected
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
def test_merge_single_qubit_moments_to_phxz_with_global_phase_in_second_moment():
|
|
253
|
+
q0 = cirq.LineQubit(0)
|
|
254
|
+
c_orig = cirq.Circuit(
|
|
255
|
+
cirq.Moment(cirq.Y(q0) ** 0.5), cirq.Moment(cirq.X(q0), cirq.GlobalPhaseGate(1j**0.5).on())
|
|
256
|
+
)
|
|
257
|
+
c_expected = cirq.Circuit(
|
|
258
|
+
cirq.Moment(
|
|
259
|
+
cirq.PhasedXZGate(axis_phase_exponent=-0.5, x_exponent=0.5, z_exponent=-1.0).on(q0),
|
|
260
|
+
cirq.GlobalPhaseGate(1j**0.5).on(),
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
context = cirq.TransformerContext(tags_to_ignore=["ignore"])
|
|
264
|
+
c_new = cirq.merge_single_qubit_moments_to_phxz(c_orig, context=context)
|
|
265
|
+
assert c_new == c_expected
|
{cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.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.dev20250617175947
|
|
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.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.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=sPjCxyCGVPBtNaanMNK5YPM7bJjdFU0zyOTghXTDVsI,1206
|
|
8
|
+
cirq/_version_test.py,sha256=yxnoWIoKoM0BDqnJAQ4a4WunJj9OU8ztjncuV8Zno6g,155
|
|
9
9
|
cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=hYyG53VJeV61X0oukK5ndZYega8lkL2FyaL1m0j6h5M,13556
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -1071,8 +1071,8 @@ cirq/transformers/measurement_transformers.py,sha256=crAYKGK90drr_3GEh5t8-Z87eSE
|
|
|
1071
1071
|
cirq/transformers/measurement_transformers_test.py,sha256=mJKYFqqMwZnD8KXVM1tmF2kcIZXkkZKlfOU9XbGxYpQ,29019
|
|
1072
1072
|
cirq/transformers/merge_k_qubit_gates.py,sha256=v9vY3f52S9QR7D_Om4APSZ65rwJH6Z7g6Gf3pD_9H3I,4380
|
|
1073
1073
|
cirq/transformers/merge_k_qubit_gates_test.py,sha256=523FmfCC7mGX_zecGaQ2tgdqBvMGiMinwJMIfKBgG8E,14016
|
|
1074
|
-
cirq/transformers/merge_single_qubit_gates.py,sha256=
|
|
1075
|
-
cirq/transformers/merge_single_qubit_gates_test.py,sha256=
|
|
1074
|
+
cirq/transformers/merge_single_qubit_gates.py,sha256=86qjW19JTC5t38TdnTKtS-M8AG2tYUxSZ9w_tM59BsU,5968
|
|
1075
|
+
cirq/transformers/merge_single_qubit_gates_test.py,sha256=hj0iTOZVgsMxY8dQJl8EYvuCDICqzzs9Yw62p5Emsrk,11213
|
|
1076
1076
|
cirq/transformers/noise_adding.py,sha256=ZBS-015Kc-BnoO-lMXfEGpCXbPu4whVgTXIB-E16ApQ,4476
|
|
1077
1077
|
cirq/transformers/noise_adding_test.py,sha256=nHOoKUPBBOkWF6A_JhIO6-G0AuFkLKBCxH7e2BOem9M,2171
|
|
1078
1078
|
cirq/transformers/optimize_for_target_gateset.py,sha256=QThizLtkzvZpUK-LG77ixuZXghDyWGNn6yHkNrzYR3o,7206
|
|
@@ -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.dev20250617175947.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1224
|
+
cirq_core-1.6.0.dev20250617175947.dist-info/METADATA,sha256=uGgKiRNg9095AJGWDcooZZTwLsIq5Enl4L27i5qfrXU,4857
|
|
1225
|
+
cirq_core-1.6.0.dev20250617175947.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
1226
|
+
cirq_core-1.6.0.dev20250617175947.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1227
|
+
cirq_core-1.6.0.dev20250617175947.dist-info/RECORD,,
|
{cirq_core-1.6.0.dev20250616231428.dist-info → cirq_core-1.6.0.dev20250617175947.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|