cirq-core 1.6.0.dev20250527184016__py3-none-any.whl → 1.6.0.dev20250528171857__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/linear_combinations.py +12 -7
- cirq/ops/linear_combinations_test.py +4 -0
- cirq/ops/pauli_string_test.py +28 -0
- {cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/RECORD +10 -10
- {cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
cirq/ops/linear_combinations.py
CHANGED
|
@@ -746,6 +746,10 @@ class PauliSum:
|
|
|
746
746
|
other = PauliSum.from_pauli_strings([PauliString(coefficient=other)])
|
|
747
747
|
elif isinstance(other, PauliString):
|
|
748
748
|
other = PauliSum.from_pauli_strings([other])
|
|
749
|
+
elif isinstance(other, raw_types.Operation) and isinstance(
|
|
750
|
+
other.gate, identity.IdentityGate
|
|
751
|
+
):
|
|
752
|
+
other = PauliSum.from_pauli_strings([PauliString()])
|
|
749
753
|
|
|
750
754
|
if not isinstance(other, PauliSum):
|
|
751
755
|
return NotImplemented
|
|
@@ -754,11 +758,8 @@ class PauliSum:
|
|
|
754
758
|
return self
|
|
755
759
|
|
|
756
760
|
def __add__(self, other):
|
|
757
|
-
if not isinstance(other, (numbers.Complex, PauliString, PauliSum)):
|
|
758
|
-
|
|
759
|
-
other = PauliString(other)
|
|
760
|
-
else:
|
|
761
|
-
return NotImplemented
|
|
761
|
+
if not isinstance(other, (numbers.Complex, PauliString, PauliSum, raw_types.Operation)):
|
|
762
|
+
return NotImplemented
|
|
762
763
|
result = self.copy()
|
|
763
764
|
result += other
|
|
764
765
|
return result
|
|
@@ -772,8 +773,12 @@ class PauliSum:
|
|
|
772
773
|
def __isub__(self, other):
|
|
773
774
|
if isinstance(other, numbers.Complex):
|
|
774
775
|
other = PauliSum.from_pauli_strings([PauliString(coefficient=other)])
|
|
775
|
-
|
|
776
|
+
elif isinstance(other, PauliString):
|
|
776
777
|
other = PauliSum.from_pauli_strings([other])
|
|
778
|
+
elif isinstance(other, raw_types.Operation) and isinstance(
|
|
779
|
+
other.gate, identity.IdentityGate
|
|
780
|
+
):
|
|
781
|
+
other = PauliSum.from_pauli_strings([PauliString()])
|
|
777
782
|
|
|
778
783
|
if not isinstance(other, PauliSum):
|
|
779
784
|
return NotImplemented
|
|
@@ -782,7 +787,7 @@ class PauliSum:
|
|
|
782
787
|
return self
|
|
783
788
|
|
|
784
789
|
def __sub__(self, other):
|
|
785
|
-
if not isinstance(other, (numbers.Complex, PauliString, PauliSum)):
|
|
790
|
+
if not isinstance(other, (numbers.Complex, PauliString, PauliSum, raw_types.Operation)):
|
|
786
791
|
return NotImplemented
|
|
787
792
|
result = self.copy()
|
|
788
793
|
result -= other
|
|
@@ -971,6 +971,10 @@ def test_paulisum_validation():
|
|
|
971
971
|
ps += cirq.I(cirq.LineQubit(0))
|
|
972
972
|
assert ps == cirq.PauliSum(cirq.LinearDict({frozenset(): complex(1)}))
|
|
973
973
|
|
|
974
|
+
ps = cirq.PauliSum()
|
|
975
|
+
ps -= cirq.I(cirq.LineQubit(0))
|
|
976
|
+
assert ps == cirq.PauliSum(cirq.LinearDict({frozenset(): complex(-1)}))
|
|
977
|
+
|
|
974
978
|
|
|
975
979
|
def test_add_number_paulisum():
|
|
976
980
|
q = cirq.LineQubit.range(2)
|
cirq/ops/pauli_string_test.py
CHANGED
|
@@ -1992,3 +1992,31 @@ def test_resolve(resolve_fn):
|
|
|
1992
1992
|
pst = cirq.PauliString({q: 'x'}, coefficient=t)
|
|
1993
1993
|
ps1 = cirq.PauliString({q: 'x'}, coefficient=1j)
|
|
1994
1994
|
assert resolve_fn(pst, {'t': 1j}) == ps1
|
|
1995
|
+
|
|
1996
|
+
|
|
1997
|
+
@pytest.mark.parametrize(
|
|
1998
|
+
'gate1,gate2',
|
|
1999
|
+
[
|
|
2000
|
+
(cirq.I, cirq.I),
|
|
2001
|
+
(cirq.I, cirq.X),
|
|
2002
|
+
(cirq.I, cirq.Y),
|
|
2003
|
+
(cirq.I, cirq.Z),
|
|
2004
|
+
(cirq.X, cirq.I),
|
|
2005
|
+
(cirq.Y, cirq.I),
|
|
2006
|
+
(cirq.Z, cirq.I),
|
|
2007
|
+
],
|
|
2008
|
+
ids=str,
|
|
2009
|
+
)
|
|
2010
|
+
def test_pauli_ops_identity_gate_operation(gate1: cirq.Pauli, gate2: cirq.Pauli) -> None:
|
|
2011
|
+
# TODO: Issue #7280 - Support addition and subtraction of identity gate operations.
|
|
2012
|
+
if gate1 == gate2 == cirq.I:
|
|
2013
|
+
pytest.skip('Not yet implemented per #7280')
|
|
2014
|
+
q = cirq.LineQubit(0)
|
|
2015
|
+
pauli1, pauli2 = gate1.on(q), gate2.on(q)
|
|
2016
|
+
unitary1, unitary2 = cirq.unitary(gate1), cirq.unitary(gate2)
|
|
2017
|
+
addition = pauli1 + pauli2
|
|
2018
|
+
assert isinstance(addition, cirq.PauliSum)
|
|
2019
|
+
assert np.array_equal(addition.matrix(), unitary1 + unitary2)
|
|
2020
|
+
subtraction = pauli1 - pauli2
|
|
2021
|
+
assert isinstance(subtraction, cirq.PauliSum)
|
|
2022
|
+
assert np.array_equal(subtraction.matrix(), unitary1 - unitary2)
|
{cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.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.dev20250528171857
|
|
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.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/RECORD
RENAMED
|
@@ -4,8 +4,8 @@ cirq/_compat_test.py,sha256=ZSmenkbqEfRJpGsvutmV8vgIlfZCWj8GAVgi3t5YRso,34635
|
|
|
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=PLNH6NtOWK7p4hvzUbwWpwqVfyUq1Y9BfFkVgZ6BFG8,1206
|
|
8
|
+
cirq/_version_test.py,sha256=gC5GnZXvxeCGQg8goiXNHzjF3SxO76YteYECwqfvGzM,155
|
|
9
9
|
cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=S-zUVI4D_XnAxyR6z7WHDImCVmB_awJp6EStD1-CNPU,13621
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -315,8 +315,8 @@ cirq/ops/identity.py,sha256=jWPE3jWLduXF5JgA0qol2blHXRvFUndClukG6nwGvUE,5862
|
|
|
315
315
|
cirq/ops/identity_test.py,sha256=8_uQpXvHgHHLO_gfOI4pTVwnZnqrUfinaJz5ULPXMFI,7976
|
|
316
316
|
cirq/ops/kraus_channel.py,sha256=uSLq2AG72zbwzcbiEETFOAZ35KNR9U9KIFO31HYzLKA,5072
|
|
317
317
|
cirq/ops/kraus_channel_test.py,sha256=8B0Ql1_93GldwknFCtu54k36a_WGQJIpSKJ65vXxS8I,4857
|
|
318
|
-
cirq/ops/linear_combinations.py,sha256=
|
|
319
|
-
cirq/ops/linear_combinations_test.py,sha256=
|
|
318
|
+
cirq/ops/linear_combinations.py,sha256=AQA0aFDuHXks44fFtevrc2Zl1chleSlf1A0LkmrZrW8,39883
|
|
319
|
+
cirq/ops/linear_combinations_test.py,sha256=EYqrWlFFThv8dl5B_9yIckEn_z3-Nfzh7rdVzGpIVWM,67351
|
|
320
320
|
cirq/ops/matrix_gates.py,sha256=w-yDz2ZmIDiSTLO6Qhp6NrJJFJOJIjrt3okK7rRcZ68,10309
|
|
321
321
|
cirq/ops/matrix_gates_test.py,sha256=5ZVdkTODOXKv5fi3xDqJA0gc9cYBMTd-KuKHyK-dxHI,14261
|
|
322
322
|
cirq/ops/measure_util.py,sha256=wtq09zJ3If9eYwxCG6hvy8hCdQWu1DIzKKcsKsmAfVo,7338
|
|
@@ -344,7 +344,7 @@ cirq/ops/pauli_string_phasor.py,sha256=JLKZem7rdshQ0doNvFMJmP7cLhl9lCsHAI1QlOmbm
|
|
|
344
344
|
cirq/ops/pauli_string_phasor_test.py,sha256=-1mB1WLEFlrKnSfcgR1LabTaeLYf2bvcJQdWxEImGH4,27767
|
|
345
345
|
cirq/ops/pauli_string_raw_types.py,sha256=lXW-Fv2TTv77g_7VMdQun33y4reD4p7dS7g9Nm1Id20,2256
|
|
346
346
|
cirq/ops/pauli_string_raw_types_test.py,sha256=jjFEbQxGsazsR8p4y-EK7SaTryRWagR9Hi7YuixXi6A,2684
|
|
347
|
-
cirq/ops/pauli_string_test.py,sha256=
|
|
347
|
+
cirq/ops/pauli_string_test.py,sha256=Z1H2K3bp8oCcWTBEWOTeRBhwUWukRsxHyGFEILfo46o,73823
|
|
348
348
|
cirq/ops/pauli_sum_exponential.py,sha256=Zq8YBMZ7sLLEPQuoX4uR95I9VY4C38Ma8FtOEjQGr3k,4861
|
|
349
349
|
cirq/ops/pauli_sum_exponential_test.py,sha256=u9fVBUMuiIb6xOPC2GRTR3zFUeO6N3vanejUk5_u9_8,5485
|
|
350
350
|
cirq/ops/permutation_gate.py,sha256=CiAWDXloj3kszU-aEarBaCXcK73_6vJkcnnHWPKjVY8,4211
|
|
@@ -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.dev20250528171857.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1224
|
+
cirq_core-1.6.0.dev20250528171857.dist-info/METADATA,sha256=bLzy9twUdaRYiURZTbWTLFvOYmAajj7h_6wT01RVtLg,4857
|
|
1225
|
+
cirq_core-1.6.0.dev20250528171857.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
1226
|
+
cirq_core-1.6.0.dev20250528171857.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1227
|
+
cirq_core-1.6.0.dev20250528171857.dist-info/RECORD,,
|
{cirq_core-1.6.0.dev20250527184016.dist-info → cirq_core-1.6.0.dev20250528171857.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|