cirq-core 1.4.0.dev20240401232442__py3-none-any.whl → 1.4.0.dev20240403000201__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.0.dev20240401232442"
1
+ __version__ = "1.4.0.dev20240403000201"
@@ -16,6 +16,7 @@
16
16
  import abc
17
17
  from functools import cached_property
18
18
  from typing import Any, Dict, Iterator, Sequence, Type, TYPE_CHECKING, Generic, TypeVar
19
+ import warnings
19
20
 
20
21
  import numpy as np
21
22
 
@@ -124,7 +125,16 @@ class StateVectorTrialResult(
124
125
 
125
126
  @cached_property
126
127
  def final_state_vector(self) -> np.ndarray:
127
- return self._get_merged_sim_state().target_tensor.reshape(-1)
128
+ ret = self._get_merged_sim_state().target_tensor.reshape(-1)
129
+ norm = np.linalg.norm(ret)
130
+ if abs(norm - 1) > np.sqrt(np.finfo(ret.dtype).eps):
131
+ warnings.warn(
132
+ f"final state vector's {norm=} is too far from 1,"
133
+ f" {abs(norm-1)} > {np.sqrt(np.finfo(ret.dtype).eps)}."
134
+ "skipping renormalization"
135
+ )
136
+ return ret
137
+ return ret / norm
128
138
 
129
139
  def state_vector(self, copy: bool = False) -> np.ndarray:
130
140
  """Return the state vector at the end of the computation.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.4.0.dev20240401232442
3
+ Version: 1.4.0.dev20240403000201
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
@@ -14,7 +14,7 @@ Requires-Dist: networkx >=2.4
14
14
  Requires-Dist: numpy ~=1.16
15
15
  Requires-Dist: pandas
16
16
  Requires-Dist: sortedcontainers ~=2.0
17
- Requires-Dist: scipy
17
+ Requires-Dist: scipy ~=1.12.0
18
18
  Requires-Dist: sympy
19
19
  Requires-Dist: typing-extensions >=4.2
20
20
  Requires-Dist: tqdm
@@ -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=X7V7ZuAhD4DHQeeu7HPCaJ2yvsSc0Y1L8aFnFrYVFok,40
7
+ cirq/_version.py,sha256=6WQnSPTrmyyChtWqYFmIWtDpZkLLZ4a0iQ8CAYUu5Zk,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
@@ -909,7 +909,7 @@ cirq/sim/sparse_simulator_test.py,sha256=3EAeCHUQeKllAAtdw14X592zBsGQY_vwfIYK-gE
909
909
  cirq/sim/state_vector.py,sha256=N6N9EELlW66UaLTBaq62ms0XkfIK7CzN9SBM7t52dXo,13428
910
910
  cirq/sim/state_vector_simulation_state.py,sha256=e4it_DT1J-30S3OX_gfMJiWAttFaVOMEPQ-Y1ARWnDg,17616
911
911
  cirq/sim/state_vector_simulation_state_test.py,sha256=UtGMIurlV6N74nX7qoVnGoRhwF35-ghDEIP7Mj5AXmI,9841
912
- cirq/sim/state_vector_simulator.py,sha256=Q-wCmJdLIoJAssTvrZmGCpnooFHjZNXr_yeyy5R0NFs,7559
912
+ cirq/sim/state_vector_simulator.py,sha256=M3k9VR7nht1gcovBjc3CaEoKbYIsCImAJyjS0_wb3ko,7942
913
913
  cirq/sim/state_vector_simulator_test.py,sha256=wJq1OZRzKokeM9cJyaJXi6wHH2qi97h0HmJlYOEBDzU,7864
914
914
  cirq/sim/state_vector_test.py,sha256=OjhAL2tWqJWstHV8RvJYQVqg95zm0PcS9nQKrLOhMmQ,16934
915
915
  cirq/sim/clifford/__init__.py,sha256=lD7l6JuE5n0xwvOYNYH-giCH3qAEVH1SUwDrZM1jKKY,636
@@ -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.dev20240401232442.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1158
- cirq_core-1.4.0.dev20240401232442.dist-info/METADATA,sha256=fCosNfxIMwHLtTgjraDEOs4yjJESjpWsosgTLn7IK9U,2069
1159
- cirq_core-1.4.0.dev20240401232442.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1160
- cirq_core-1.4.0.dev20240401232442.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1161
- cirq_core-1.4.0.dev20240401232442.dist-info/RECORD,,
1157
+ cirq_core-1.4.0.dev20240403000201.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1158
+ cirq_core-1.4.0.dev20240403000201.dist-info/METADATA,sha256=_TLZ3aXNG2eTLhGejB--yoh1lzGG8HiWW4WBuubVhGA,2078
1159
+ cirq_core-1.4.0.dev20240403000201.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
1160
+ cirq_core-1.4.0.dev20240403000201.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1161
+ cirq_core-1.4.0.dev20240403000201.dist-info/RECORD,,