cirq-core 1.4.0.dev20231218193016__py3-none-any.whl → 1.4.0.dev20231218234457__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/contrib/quimb/mps_simulator_test.py +1 -1
- cirq/experiments/qubit_characterizations.py +33 -1
- cirq/experiments/qubit_characterizations_test.py +3 -4
- cirq/experiments/random_quantum_circuit_generation.py +1 -1
- cirq/protocols/json_serialization_test.py +1 -1
- {cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/METADATA +1 -1
- {cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/RECORD +11 -11
- {cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/LICENSE +0 -0
- {cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/WHEEL +0 -0
- {cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.4.0.
|
|
1
|
+
__version__ = "1.4.0.dev20231218234457"
|
|
@@ -335,7 +335,7 @@ def test_random_circuits_equal_more_rows():
|
|
|
335
335
|
assert_same_output_as_dense(circuit, qubits)
|
|
336
336
|
|
|
337
337
|
|
|
338
|
-
def
|
|
338
|
+
def test_random_circuits_equal_more_cols():
|
|
339
339
|
circuit = cirq.testing.random_circuit(
|
|
340
340
|
qubits=cirq.GridQubit.rect(2, 3), n_moments=6, op_density=1.0
|
|
341
341
|
)
|
|
@@ -17,6 +17,7 @@ import itertools
|
|
|
17
17
|
|
|
18
18
|
from typing import Any, cast, Iterator, List, Optional, Sequence, Tuple, TYPE_CHECKING
|
|
19
19
|
import numpy as np
|
|
20
|
+
from scipy.optimize import curve_fit
|
|
20
21
|
|
|
21
22
|
from matplotlib import pyplot as plt
|
|
22
23
|
|
|
@@ -92,13 +93,44 @@ class RandomizedBenchMarkResult:
|
|
|
92
93
|
fig, ax = plt.subplots(1, 1, figsize=(8, 8)) # pragma: no cover
|
|
93
94
|
ax = cast(plt.Axes, ax) # pragma: no cover
|
|
94
95
|
ax.set_ylim((0.0, 1.0)) # pragma: no cover
|
|
95
|
-
ax.plot(self._num_cfds_seq, self._gnd_state_probs, 'ro
|
|
96
|
+
ax.plot(self._num_cfds_seq, self._gnd_state_probs, 'ro', label='data', **plot_kwargs)
|
|
97
|
+
x = np.linspace(self._num_cfds_seq[0], self._num_cfds_seq[-1], 100)
|
|
98
|
+
opt_params, _ = self._fit_exponential()
|
|
99
|
+
ax.plot(x, opt_params[0] * opt_params[2] ** x + opt_params[1], '--k', label='fit')
|
|
100
|
+
ax.legend(loc='upper right')
|
|
96
101
|
ax.set_xlabel(r"Number of Cliffords")
|
|
97
102
|
ax.set_ylabel('Ground State Probability')
|
|
98
103
|
if show_plot:
|
|
99
104
|
fig.show()
|
|
100
105
|
return ax
|
|
101
106
|
|
|
107
|
+
def pauli_error(self) -> float:
|
|
108
|
+
r"""Returns the Pauli error inferred from randomized benchmarking.
|
|
109
|
+
|
|
110
|
+
If sequence fidelity $F$ decays with number of gates $m$ as
|
|
111
|
+
|
|
112
|
+
$$F = A p^m + B,$$
|
|
113
|
+
|
|
114
|
+
where $0 < p < 1$, then the Pauli error $r_p$ is given by
|
|
115
|
+
|
|
116
|
+
$$r_p = (1 - 1/d^2) * (1 - p),$$
|
|
117
|
+
|
|
118
|
+
where $d = 2^N_Q$ is the Hilbert space dimension and $N_Q$ is the number of qubits.
|
|
119
|
+
"""
|
|
120
|
+
opt_params, _ = self._fit_exponential()
|
|
121
|
+
p = opt_params[2]
|
|
122
|
+
return (1.0 - 1.0 / 4.0) * (1.0 - p)
|
|
123
|
+
|
|
124
|
+
def _fit_exponential(self) -> Tuple[np.ndarray, np.ndarray]:
|
|
125
|
+
exp_fit = lambda x, A, B, p: A * p**x + B
|
|
126
|
+
return curve_fit(
|
|
127
|
+
f=exp_fit,
|
|
128
|
+
xdata=self._num_cfds_seq,
|
|
129
|
+
ydata=self._gnd_state_probs,
|
|
130
|
+
p0=[0.5, 0.5, 1.0 - 1e-3],
|
|
131
|
+
bounds=([0, 0.25, 0], [0.5, 0.75, 1]),
|
|
132
|
+
)
|
|
133
|
+
|
|
102
134
|
|
|
103
135
|
class TomographyResult:
|
|
104
136
|
"""Results from a state tomography experiment."""
|
|
@@ -85,12 +85,11 @@ def test_single_qubit_randomized_benchmarking():
|
|
|
85
85
|
# sequences is always unity.
|
|
86
86
|
simulator = sim.Simulator()
|
|
87
87
|
qubit = GridQubit(0, 0)
|
|
88
|
-
num_cfds =
|
|
89
|
-
results = single_qubit_randomized_benchmarking(
|
|
90
|
-
simulator, qubit, num_clifford_range=num_cfds, repetitions=100
|
|
91
|
-
)
|
|
88
|
+
num_cfds = tuple(np.logspace(np.log10(5), 3, 5, dtype=int))
|
|
89
|
+
results = single_qubit_randomized_benchmarking(simulator, qubit, num_clifford_range=num_cfds)
|
|
92
90
|
g_pops = np.asarray(results.data)[:, 1]
|
|
93
91
|
assert np.isclose(np.mean(g_pops), 1.0)
|
|
92
|
+
assert np.isclose(results.pauli_error(), 0.0, atol=1e-7) # warning is expected
|
|
94
93
|
|
|
95
94
|
|
|
96
95
|
def test_two_qubit_randomized_benchmarking():
|
|
@@ -237,7 +237,7 @@ def test_not_yet_serializable_no_superfluous(mod_spec: ModuleJsonTestSpec):
|
|
|
237
237
|
|
|
238
238
|
|
|
239
239
|
@pytest.mark.parametrize('mod_spec', MODULE_TEST_SPECS, ids=repr)
|
|
240
|
-
def
|
|
240
|
+
def test_mutually_exclusive_not_serialize_lists(mod_spec: ModuleJsonTestSpec):
|
|
241
241
|
common = set(mod_spec.should_not_be_serialized) & set(mod_spec.not_yet_serializable)
|
|
242
242
|
assert len(common) == 0, (
|
|
243
243
|
f"Defined in both {mod_spec.name} 'Not yet serializable' "
|
{cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.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.dev20231218234457
|
|
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.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/RECORD
RENAMED
|
@@ -4,7 +4,7 @@ cirq/_compat_test.py,sha256=iQJYqIP1uyRe8mNUwi2VKccyUaJDFYH7b3Fg6cqQLQw,35053
|
|
|
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=-HaCO8zLtHZyG4GUXGGAwr_fP3r2hChhkbR5eMb7Ml0,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=S0HaPOCUIck-vNSQlS6KxnQtle6w-2dGuSxkUbJQY9Y,13168
|
|
@@ -126,7 +126,7 @@ cirq/contrib/quimb/density_matrix_test.py,sha256=llLw_VwvDuFM3DnpL4i885vSWdNll-2
|
|
|
126
126
|
cirq/contrib/quimb/grid_circuits.py,sha256=vuMiMaVXsJi-8ZwPnGcKJVVVYlXGi3O-CCwRVwz18qQ,4628
|
|
127
127
|
cirq/contrib/quimb/grid_circuits_test.py,sha256=0Pl_wea4E_HDa9zaKkmazltFdorB4QsaL2rmMrDv8Sw,3223
|
|
128
128
|
cirq/contrib/quimb/mps_simulator.py,sha256=wz7Et54hzoShXtxrXrJ2T2Im5c_hvz7N-SCaAQ3G7qk,24705
|
|
129
|
-
cirq/contrib/quimb/mps_simulator_test.py,sha256=
|
|
129
|
+
cirq/contrib/quimb/mps_simulator_test.py,sha256=6sjC95Ba4WCFoI6zlJmZCYi8GFwI58wkpXQdAoF2Sms,17007
|
|
130
130
|
cirq/contrib/quimb/state_vector.py,sha256=WziCD7uMeh-cHI6F6DJCjqFKOtji_us2rf0vQhvtnvc,6686
|
|
131
131
|
cirq/contrib/quimb/state_vector_test.py,sha256=Jwuk_9hL00OA-WDRBafGY16ZHiBJQ18Dn8Bx2l8AAoc,5800
|
|
132
132
|
cirq/contrib/quirk/__init__.py,sha256=B8cZpO41P5mzkn-4rLJF9SRoVm-MLBmhuFMxObbICc4,704
|
|
@@ -184,9 +184,9 @@ cirq/experiments/n_qubit_tomography.py,sha256=9M_kf2-1hvFxfZOWND7ACwHYgD9SJU5nYF
|
|
|
184
184
|
cirq/experiments/n_qubit_tomography_test.py,sha256=wHfV2OpGYSDXfoyEh-B5dc1Dv8sxKNFbUoHyjIWZoFk,4362
|
|
185
185
|
cirq/experiments/purity_estimation.py,sha256=6D1UwFlQRzHeajXMTyTUfBYAc0jJQ8Cfz4lteFKeUaM,2467
|
|
186
186
|
cirq/experiments/purity_estimation_test.py,sha256=xlBGp0NOBYR0IhTy3bckHPgi81FkGSGxKqk9hwXG-I8,923
|
|
187
|
-
cirq/experiments/qubit_characterizations.py,sha256=
|
|
188
|
-
cirq/experiments/qubit_characterizations_test.py,sha256=
|
|
189
|
-
cirq/experiments/random_quantum_circuit_generation.py,sha256=
|
|
187
|
+
cirq/experiments/qubit_characterizations.py,sha256=nZMNmHCtTBx_AVmymStQomnN5IuNFBXKCABkYDqqgm0,28846
|
|
188
|
+
cirq/experiments/qubit_characterizations_test.py,sha256=5YYx-j04HzsF5nGtq0pxvAEUgXX9iE_7cdqVExdAoIo,7781
|
|
189
|
+
cirq/experiments/random_quantum_circuit_generation.py,sha256=R_w7z35plUHEYBY0-F80bPcWJSSSjNQDaP2GbxVBEZg,28143
|
|
190
190
|
cirq/experiments/random_quantum_circuit_generation_test.py,sha256=1rvgN8-Ajedn_70FyYKVzjvzR6NVpHj6KQgo6tra-Jc,15995
|
|
191
191
|
cirq/experiments/readout_confusion_matrix.py,sha256=gsRjGJTDcxRPtY7G63t-nYoJ1BcByC1jl02zHh2B8fQ,17278
|
|
192
192
|
cirq/experiments/readout_confusion_matrix_test.py,sha256=R4UoGklVJ2owqeDTRVP4M9gYynzVYgw-Y76VLcoIJtY,6766
|
|
@@ -398,7 +398,7 @@ cirq/protocols/has_unitary_protocol_test.py,sha256=IjmJ3dqvteFUUO4FLwCTokgUvYy8H
|
|
|
398
398
|
cirq/protocols/inverse_protocol.py,sha256=CEqtGRRj86WQyyALonRXxQrNq-fENOs_Zqrlr_BVau8,4115
|
|
399
399
|
cirq/protocols/inverse_protocol_test.py,sha256=pqqIU4_G4Npc9Z-SeoM9eCB2T5JRTeI02NCXhP0UtaI,2017
|
|
400
400
|
cirq/protocols/json_serialization.py,sha256=DVgbYQBYlPVV50gidAIDuRJn3griTkD-PDJiJTAgxe8,29274
|
|
401
|
-
cirq/protocols/json_serialization_test.py,sha256=
|
|
401
|
+
cirq/protocols/json_serialization_test.py,sha256=1w1hN5mTUwEE4aMlPrpiTy35mT1PjO34iy7H2FfgI6Q,28793
|
|
402
402
|
cirq/protocols/kraus_protocol.py,sha256=GKQ748yxo6B6i0jUzq8OyR6lcEFYbh4FV2UryjUgSuk,9158
|
|
403
403
|
cirq/protocols/kraus_protocol_test.py,sha256=QpPwkk7XBiGKNdrOcjXqtvhESVbUzujnUPz47uUNyqc,5401
|
|
404
404
|
cirq/protocols/measurement_key_protocol.py,sha256=hl7xFi1Evebh8MQNLuUffhsUkggr4SdWUm4kIr9s2iI,13425
|
|
@@ -1148,8 +1148,8 @@ cirq/work/sampler.py,sha256=JVv1vvfa6EgFiR3UeDk44U186dCrioH2NZXueCgsb9w,19828
|
|
|
1148
1148
|
cirq/work/sampler_test.py,sha256=zo1Hj6sn6fLs_WZMxYRApBqgBsldmptn74NL0jhNukc,12325
|
|
1149
1149
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1150
1150
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1151
|
-
cirq_core-1.4.0.
|
|
1152
|
-
cirq_core-1.4.0.
|
|
1153
|
-
cirq_core-1.4.0.
|
|
1154
|
-
cirq_core-1.4.0.
|
|
1155
|
-
cirq_core-1.4.0.
|
|
1151
|
+
cirq_core-1.4.0.dev20231218234457.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1152
|
+
cirq_core-1.4.0.dev20231218234457.dist-info/METADATA,sha256=H_acyYJyfG7pF0SWcGIlaymmyuNddz4Z7Yc8F3el82k,2075
|
|
1153
|
+
cirq_core-1.4.0.dev20231218234457.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
1154
|
+
cirq_core-1.4.0.dev20231218234457.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1155
|
+
cirq_core-1.4.0.dev20231218234457.dist-info/RECORD,,
|
{cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.4.0.dev20231218193016.dist-info → cirq_core-1.4.0.dev20231218234457.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|