cirq-core 1.4.0.dev20240513222249__py3-none-any.whl → 1.4.0.dev20240516195256__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/linalg/decompositions.py +5 -3
- cirq/linalg/diagonalize.py +5 -4
- cirq/linalg/predicates.py +8 -6
- cirq/linalg/transformations.py +2 -1
- cirq/testing/lin_alg_utils.py +5 -3
- cirq/transformers/analytical_decompositions/controlled_gate_decomposition.py +3 -1
- {cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/METADATA +1 -1
- {cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/RECORD +12 -12
- {cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/LICENSE +0 -0
- {cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/WHEEL +0 -0
- {cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.4.0.
|
|
1
|
+
__version__ = "1.4.0.dev20240516195256"
|
cirq/linalg/decompositions.py
CHANGED
|
@@ -222,8 +222,9 @@ def kron_factor_4x4_to_2x2s(matrix: np.ndarray) -> Tuple[complex, np.ndarray, np
|
|
|
222
222
|
f2[(a & 1) ^ i, (b & 1) ^ j] = matrix[a ^ i, b ^ j]
|
|
223
223
|
|
|
224
224
|
# Rescale factors to have unit determinants.
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
226
|
+
f1 /= np.sqrt(np.linalg.det(f1)) or 1
|
|
227
|
+
f2 /= np.sqrt(np.linalg.det(f2)) or 1
|
|
227
228
|
|
|
228
229
|
# Determine global phase.
|
|
229
230
|
g = matrix[a, b] / (f1[a >> 1, b >> 1] * f2[a & 1, b & 1])
|
|
@@ -965,7 +966,8 @@ def kak_vector(
|
|
|
965
966
|
# The algorithm in the appendix mentioned above is slightly incorrect in
|
|
966
967
|
# that it only works for elements of SU(4). A phase correction must be
|
|
967
968
|
# added to deal with U(4).
|
|
968
|
-
|
|
969
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
970
|
+
phases = np.log(-1j * np.linalg.det(unitary)).imag + np.pi / 2
|
|
969
971
|
evals *= np.exp(-1j * phases / 2)[..., np.newaxis]
|
|
970
972
|
|
|
971
973
|
# The following steps follow the appendix exactly.
|
cirq/linalg/diagonalize.py
CHANGED
|
@@ -255,10 +255,11 @@ def bidiagonalize_unitary_with_special_orthogonals(
|
|
|
255
255
|
)
|
|
256
256
|
|
|
257
257
|
# Convert to special orthogonal w/o breaking diagonalization.
|
|
258
|
-
|
|
259
|
-
left
|
|
260
|
-
|
|
261
|
-
right
|
|
258
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
259
|
+
if np.linalg.det(left) < 0:
|
|
260
|
+
left[0, :] *= -1
|
|
261
|
+
if np.linalg.det(right) < 0:
|
|
262
|
+
right[:, 0] *= -1
|
|
262
263
|
|
|
263
264
|
diag = combinators.dot(left, mat, right)
|
|
264
265
|
|
cirq/linalg/predicates.py
CHANGED
|
@@ -91,9 +91,10 @@ def is_special_orthogonal(matrix: np.ndarray, *, rtol: float = 1e-5, atol: float
|
|
|
91
91
|
Returns:
|
|
92
92
|
Whether the matrix is special orthogonal within the given tolerance.
|
|
93
93
|
"""
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
95
|
+
return is_orthogonal(matrix, rtol=rtol, atol=atol) and (
|
|
96
|
+
matrix.shape[0] == 0 or np.allclose(np.linalg.det(matrix), 1, rtol=rtol, atol=atol)
|
|
97
|
+
)
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
def is_unitary(matrix: np.ndarray, *, rtol: float = 1e-5, atol: float = 1e-8) -> bool:
|
|
@@ -128,9 +129,10 @@ def is_special_unitary(matrix: np.ndarray, *, rtol: float = 1e-5, atol: float =
|
|
|
128
129
|
Whether the matrix is unitary with unit determinant within the given
|
|
129
130
|
tolerance.
|
|
130
131
|
"""
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
133
|
+
return is_unitary(matrix, rtol=rtol, atol=atol) and (
|
|
134
|
+
matrix.shape[0] == 0 or np.allclose(np.linalg.det(matrix), 1, rtol=rtol, atol=atol)
|
|
135
|
+
)
|
|
134
136
|
|
|
135
137
|
|
|
136
138
|
def is_normal(matrix: np.ndarray, *, rtol: float = 1e-5, atol: float = 1e-8) -> bool:
|
cirq/linalg/transformations.py
CHANGED
|
@@ -592,7 +592,8 @@ def to_special(u: np.ndarray) -> np.ndarray:
|
|
|
592
592
|
Returns:
|
|
593
593
|
the special unitary matrix
|
|
594
594
|
"""
|
|
595
|
-
|
|
595
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
596
|
+
return u * (np.linalg.det(u) ** (-1 / len(u)))
|
|
596
597
|
|
|
597
598
|
|
|
598
599
|
def state_vector_kronecker_product(t1: np.ndarray, t2: np.ndarray) -> np.ndarray:
|
cirq/testing/lin_alg_utils.py
CHANGED
|
@@ -133,7 +133,8 @@ def random_special_unitary(
|
|
|
133
133
|
The sampled special unitary.
|
|
134
134
|
"""
|
|
135
135
|
r = random_unitary(dim, random_state=random_state)
|
|
136
|
-
|
|
136
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
137
|
+
r[0, :] /= np.linalg.det(r)
|
|
137
138
|
return r
|
|
138
139
|
|
|
139
140
|
|
|
@@ -152,8 +153,9 @@ def random_special_orthogonal(
|
|
|
152
153
|
The sampled special orthogonal matrix.
|
|
153
154
|
"""
|
|
154
155
|
m = random_orthogonal(dim, random_state=random_state)
|
|
155
|
-
|
|
156
|
-
m
|
|
156
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
157
|
+
if np.linalg.det(m) < 0:
|
|
158
|
+
m[0, :] *= -1
|
|
157
159
|
return m
|
|
158
160
|
|
|
159
161
|
|
|
@@ -47,7 +47,9 @@ def _decompose_abc(matrix: np.ndarray) -> Tuple[np.ndarray, np.ndarray, np.ndarr
|
|
|
47
47
|
See [1], chapter 4.
|
|
48
48
|
"""
|
|
49
49
|
assert matrix.shape == (2, 2)
|
|
50
|
-
|
|
50
|
+
with np.errstate(divide="ignore", invalid="ignore"):
|
|
51
|
+
# On MacOS, np.linalg.det emits superflous warnings
|
|
52
|
+
delta = np.angle(np.linalg.det(matrix)) * 0.5
|
|
51
53
|
alpha = np.angle(matrix[0, 0]) + np.angle(matrix[0, 1]) - 2 * delta
|
|
52
54
|
beta = np.angle(matrix[0, 0]) - np.angle(matrix[0, 1])
|
|
53
55
|
|
{cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.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.dev20240516195256
|
|
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.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.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=REHjzYL7L1g_xXkdTr1cvEkyu6mebhfP6WP7YWryNSA,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
|
|
@@ -246,17 +246,17 @@ cirq/ion/__init__.py,sha256=GKBoQfjGrCOkVQR1MqK32s9YxA8PsrKecekz7LChUlk,734
|
|
|
246
246
|
cirq/linalg/__init__.py,sha256=iMN1jVWzuZrSdHuE-gN2N1QyP0q6wgj6F4zetxJLCJQ,2527
|
|
247
247
|
cirq/linalg/combinators.py,sha256=5q_cNjnJrDgC7qMX8rYdnCmBKXT_iVbtxnCeJQ4ZPTM,5350
|
|
248
248
|
cirq/linalg/combinators_test.py,sha256=nZ3snkVA2nAOZ6WJK1hNd1f_i2a5xNdnostfMD1upbc,4699
|
|
249
|
-
cirq/linalg/decompositions.py,sha256=
|
|
249
|
+
cirq/linalg/decompositions.py,sha256=hqo76094MnUrMUe1BFQagfB3fArEPjo8Jkb1fEL2Yc8,39225
|
|
250
250
|
cirq/linalg/decompositions_test.py,sha256=-6q2u3BDG9b32QSUAjhmBNWrL3KzyiMH_R0WIHhdOqU,25790
|
|
251
|
-
cirq/linalg/diagonalize.py,sha256=
|
|
251
|
+
cirq/linalg/diagonalize.py,sha256=Ym7C0JTAC9xfRQDYI72U6NxMYg0DfchjfXcbdg_92QE,10051
|
|
252
252
|
cirq/linalg/diagonalize_test.py,sha256=H-JcLvcCBdN-DrKo2o1Gs7B8Q9SU70oAZmdT4yTLAi4,9089
|
|
253
253
|
cirq/linalg/operator_spaces.py,sha256=uZSc9154p63R2UqFw6pniuWcUo20epe5RK6bL3tpkbM,3813
|
|
254
254
|
cirq/linalg/operator_spaces_test.py,sha256=k2aVBYuU6ehXx_6puApE-sFxEBrOki0t0KeNbBK94hs,10097
|
|
255
|
-
cirq/linalg/predicates.py,sha256=
|
|
255
|
+
cirq/linalg/predicates.py,sha256=Q8BTlR4EvPg2KP9VodK78UEWYJbSCOTqRahn1DnFmSc,12056
|
|
256
256
|
cirq/linalg/predicates_test.py,sha256=UVDkNH2ujI80JwJwsDjbTgyALZUQJAVVCoFN1T_LLf0,21503
|
|
257
257
|
cirq/linalg/tolerance.py,sha256=ZBZOc5h7UgrKzyOStlcTRwupkjVzQu9-AwjNCCz1ZKE,1879
|
|
258
258
|
cirq/linalg/tolerance_test.py,sha256=wnmuXIGEn_mugGoNm3AigSgjV2DMFdj8xpgRTMBbO7A,2355
|
|
259
|
-
cirq/linalg/transformations.py,sha256=
|
|
259
|
+
cirq/linalg/transformations.py,sha256=errpuYfF2Cxdn2zN1NWAMfFHwu77Mfr5g3lk_MJceDI,32143
|
|
260
260
|
cirq/linalg/transformations_test.py,sha256=ofrqw8H9109vVDBelSGkMjTPkmNinYsin4rvUE_iSn4,25095
|
|
261
261
|
cirq/neutral_atoms/__init__.py,sha256=D0ewdZZvXM_PC7WiyyM8V3WqBAwrpDV_GU_sCIbtw2A,753
|
|
262
262
|
cirq/neutral_atoms/convert_to_neutral_atom_gates.py,sha256=SsXFh1-NoBGqp4yX8-jIbIw-AK40baA-qh-iTL1wS6Q,1070
|
|
@@ -974,7 +974,7 @@ cirq/testing/gate_features.py,sha256=39lXCy54-V-b7WT0UC4CQaNCsFLHDLagJVVMG8fCz98
|
|
|
974
974
|
cirq/testing/gate_features_test.py,sha256=I5hTTazOYucDCqowWtdYN4rvd9hK-9Nlv3fRjs21Bvw,2168
|
|
975
975
|
cirq/testing/json.py,sha256=is5G95eKX4QirzElQxAbxXBf-zF-N9G6I3ptjL0Ne64,6646
|
|
976
976
|
cirq/testing/json_test.py,sha256=Qblb8hCGk8FUNk-L0lwOMs91YKpsfcOj7O3Ng1YG3y4,1092
|
|
977
|
-
cirq/testing/lin_alg_utils.py,sha256=
|
|
977
|
+
cirq/testing/lin_alg_utils.py,sha256=SiW2C_ugq3OKfyioD48INjILg7AjP24Jz6q5l6L1uEI,6353
|
|
978
978
|
cirq/testing/lin_alg_utils_test.py,sha256=wtQGhHdIGe__4lL708arpN0n-nNjGIlATpsXHlkI_eM,4113
|
|
979
979
|
cirq/testing/logs.py,sha256=0nTTrOQX-T5rspj7kZxtGsqPQg06ZddRAyABT03tYrI,4053
|
|
980
980
|
cirq/testing/logs_test.py,sha256=iBFaO_cwddBlaCYhX13GL9nqRBWeGPekT9hAuZOo1CQ,5719
|
|
@@ -1049,7 +1049,7 @@ cirq/transformers/transformer_primitives_test.py,sha256=KYD1cDE_jAB54WJPjpBdoO2t
|
|
|
1049
1049
|
cirq/transformers/analytical_decompositions/__init__.py,sha256=ZNtETntol3G_n6uqzGxOmBanGMbCj0QAc-5vicN2jkM,2724
|
|
1050
1050
|
cirq/transformers/analytical_decompositions/clifford_decomposition.py,sha256=DsuuP91pm2dX0CO4rWwmJAJyAfuXMcA1UJK0g8krp7k,6726
|
|
1051
1051
|
cirq/transformers/analytical_decompositions/clifford_decomposition_test.py,sha256=AAZh_9vEb5f2E_EItPZTlMRNdv0d47AwqTn4BytX0UI,7102
|
|
1052
|
-
cirq/transformers/analytical_decompositions/controlled_gate_decomposition.py,sha256=
|
|
1052
|
+
cirq/transformers/analytical_decompositions/controlled_gate_decomposition.py,sha256=iFF2vb5tI4PVQVHBOP_tuy8EKUtGg8aMDZSdK-74YMI,8675
|
|
1053
1053
|
cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py,sha256=Pc1vNvRxcYJEERASHbCqPX1bqImGd7FzWnQcUcIo_YU,4950
|
|
1054
1054
|
cirq/transformers/analytical_decompositions/cphase_to_fsim.py,sha256=RDg0wzYa_YXBJepCgloD_OIwTOwNco98dqGoe0UsnhI,9108
|
|
1055
1055
|
cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py,sha256=bwZa0BDclAd1sX3bD-GdNF2MO5DtH7mw2YLppEK0LG0,5568
|
|
@@ -1171,8 +1171,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
|
|
|
1171
1171
|
cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
|
|
1172
1172
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1173
1173
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1174
|
-
cirq_core-1.4.0.
|
|
1175
|
-
cirq_core-1.4.0.
|
|
1176
|
-
cirq_core-1.4.0.
|
|
1177
|
-
cirq_core-1.4.0.
|
|
1178
|
-
cirq_core-1.4.0.
|
|
1174
|
+
cirq_core-1.4.0.dev20240516195256.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1175
|
+
cirq_core-1.4.0.dev20240516195256.dist-info/METADATA,sha256=bLFpi-L6s4tqQJ938ouiGOGZoFoYe1CpWcKHxSQFdII,2000
|
|
1176
|
+
cirq_core-1.4.0.dev20240516195256.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
1177
|
+
cirq_core-1.4.0.dev20240516195256.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1178
|
+
cirq_core-1.4.0.dev20240516195256.dist-info/RECORD,,
|
{cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.4.0.dev20240513222249.dist-info → cirq_core-1.4.0.dev20240516195256.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|