cirq-core 1.5.0.dev20240607171515__py3-none-any.whl → 1.5.0.dev20240610203324__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/circuits/circuit.py +13 -11
- cirq/circuits/circuit_test.py +1 -0
- cirq/experiments/xeb_sampling.py +9 -13
- {cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/METADATA +1 -1
- {cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/RECORD +10 -10
- {cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/WHEEL +0 -0
- {cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
cirq/circuits/circuit.py
CHANGED
|
@@ -145,29 +145,31 @@ class AbstractCircuit(abc.ABC):
|
|
|
145
145
|
"""
|
|
146
146
|
|
|
147
147
|
@classmethod
|
|
148
|
-
def from_moments(cls: Type[CIRCUIT_TYPE], *moments: 'cirq.OP_TREE') -> CIRCUIT_TYPE:
|
|
148
|
+
def from_moments(cls: Type[CIRCUIT_TYPE], *moments: Optional['cirq.OP_TREE']) -> CIRCUIT_TYPE:
|
|
149
149
|
"""Create a circuit from moment op trees.
|
|
150
150
|
|
|
151
151
|
Args:
|
|
152
|
-
*moments: Op
|
|
153
|
-
will be included directly in the new circuit.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
*moments: Op trees for each moment, which can be one of the following:
|
|
153
|
+
- Moment: will be included directly in the new circuit.
|
|
154
|
+
- AbstractCircuit: will be frozen, wrapped in a CircuitOperation,
|
|
155
|
+
and included in its own moment in the new circuit.
|
|
156
|
+
- None: will be skipped and omitted from the circuit. This can be
|
|
157
|
+
used to include or skip a moment based on a conditional, for example.
|
|
158
|
+
- Other OP_TREE: will be passed to `cirq.Moment` to create a new moment
|
|
159
|
+
which is then included in the new circuit. Note that in this
|
|
160
|
+
case we have the normal restriction that operations in a
|
|
161
|
+
moment must be applied to disjoint sets of qubits.
|
|
160
162
|
"""
|
|
161
163
|
return cls._from_moments(cls._make_moments(moments))
|
|
162
164
|
|
|
163
165
|
@staticmethod
|
|
164
|
-
def _make_moments(moments: Iterable['cirq.OP_TREE']) -> Iterator['cirq.Moment']:
|
|
166
|
+
def _make_moments(moments: Iterable[Optional['cirq.OP_TREE']]) -> Iterator['cirq.Moment']:
|
|
165
167
|
for m in moments:
|
|
166
168
|
if isinstance(m, Moment):
|
|
167
169
|
yield m
|
|
168
170
|
elif isinstance(m, AbstractCircuit):
|
|
169
171
|
yield Moment(m.freeze().to_op())
|
|
170
|
-
|
|
172
|
+
elif m is not None:
|
|
171
173
|
yield Moment(m)
|
|
172
174
|
|
|
173
175
|
@classmethod
|
cirq/circuits/circuit_test.py
CHANGED
cirq/experiments/xeb_sampling.py
CHANGED
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
"""Estimation of fidelity associated with experimental circuit executions."""
|
|
15
|
-
import concurrent
|
|
16
15
|
import os
|
|
17
16
|
import time
|
|
18
17
|
import uuid
|
|
19
|
-
from concurrent.futures.thread import ThreadPoolExecutor
|
|
20
18
|
from dataclasses import dataclass
|
|
21
19
|
from typing import (
|
|
22
20
|
Callable,
|
|
@@ -276,18 +274,16 @@ def _execute_sample_2q_xeb_tasks_in_batches(
|
|
|
276
274
|
run_batch = _SampleInBatches(
|
|
277
275
|
sampler=sampler, repetitions=repetitions, combinations_by_layer=combinations_by_layer
|
|
278
276
|
)
|
|
279
|
-
with ThreadPoolExecutor(max_workers=2) as pool:
|
|
280
|
-
futures = [pool.submit(run_batch, task_batch) for task_batch in batched_tasks]
|
|
281
277
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
278
|
+
records = []
|
|
279
|
+
with progress_bar(total=len(batched_tasks) * batch_size) as progress:
|
|
280
|
+
for task in batched_tasks:
|
|
281
|
+
new_records = run_batch(task)
|
|
282
|
+
if dataset_directory is not None:
|
|
283
|
+
os.makedirs(f'{dataset_directory}', exist_ok=True)
|
|
284
|
+
protocols.to_json(new_records, f'{dataset_directory}/xeb.{uuid.uuid4()}.json')
|
|
285
|
+
records.extend(new_records)
|
|
286
|
+
progress.update(batch_size)
|
|
291
287
|
return records
|
|
292
288
|
|
|
293
289
|
|
{cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cirq-core
|
|
3
|
-
Version: 1.5.0.
|
|
3
|
+
Version: 1.5.0.dev20240610203324
|
|
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.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/RECORD
RENAMED
|
@@ -4,8 +4,8 @@ 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=
|
|
8
|
-
cirq/_version_test.py,sha256=
|
|
7
|
+
cirq/_version.py,sha256=X6TQ2nt8-RjX2OqWZ4LM2bgjBhLgQB__Gc7sMjMG2S4,1206
|
|
8
|
+
cirq/_version_test.py,sha256=uj9Hg6-l3bVWFvda0wTEAtaQ2lNEp9rgHP0tb0m_Vhg,147
|
|
9
9
|
cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
|
|
10
10
|
cirq/json_resolver_cache.py,sha256=ytePZtNZgKjOF2NiVpUTuotB-JKZmQNOFIFdvXqsxHw,13271
|
|
11
11
|
cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
|
|
@@ -17,10 +17,10 @@ cirq/circuits/_box_drawing_character_data.py,sha256=QLoCXwcLL7091RdxEKO259goxt4R
|
|
|
17
17
|
cirq/circuits/_box_drawing_character_data_test.py,sha256=XO94z0piwZRHaNZHTf-5tKHQ4MKcDruMeRIKdT8GbYA,1624
|
|
18
18
|
cirq/circuits/_bucket_priority_queue.py,sha256=hxFuii2fKD8G6EKT_aVLEsA7FmSfqFXPwIbA0KsoSC4,6745
|
|
19
19
|
cirq/circuits/_bucket_priority_queue_test.py,sha256=t6u_hG7K2e2WKWrgCsKxNRtp4ghKwiCrp0_WSY0W25k,5288
|
|
20
|
-
cirq/circuits/circuit.py,sha256=
|
|
20
|
+
cirq/circuits/circuit.py,sha256=XIwQh9Gkb8ya4Q2Q92EfsAUh9W6YZemcGqlu1cZCi2s,114620
|
|
21
21
|
cirq/circuits/circuit_operation.py,sha256=D4u8jDD4fGOca1xnZPN1obuKTIouXENUfnxOF2JrwgU,34375
|
|
22
22
|
cirq/circuits/circuit_operation_test.py,sha256=_0iQJ3h_dnQcQmbGRZbc-NqdglJTXantbj72ggqLKNE,44724
|
|
23
|
-
cirq/circuits/circuit_test.py,sha256=
|
|
23
|
+
cirq/circuits/circuit_test.py,sha256=sRZC558PZZZUHByZ1R00_j8ez6TL9l5ZmT8YLGopH_Q,160117
|
|
24
24
|
cirq/circuits/frozen_circuit.py,sha256=_0SkmIiQ4UjIug-k_iO00ulDFoFnxmAHvXX2I2HHN8k,9262
|
|
25
25
|
cirq/circuits/frozen_circuit_test.py,sha256=rHyii8hLhOQ6jdA8dC1OcYPGnyeBC4uY5Q53XspkkCk,4133
|
|
26
26
|
cirq/circuits/insert_strategy.py,sha256=L0OLXuo24TtBfdJGOAG2PsVDMrbvQl4iN5lUk6IPuyo,2851
|
|
@@ -200,7 +200,7 @@ cirq/experiments/two_qubit_xeb.py,sha256=wdLxBi3LrAlPF-SQV9Tf66k31XC2cVHNPhpR-VL
|
|
|
200
200
|
cirq/experiments/two_qubit_xeb_test.py,sha256=Tlr32vuJpyepkMBVVkN6ipjRyDr8DIixfBumEeGXzDM,10073
|
|
201
201
|
cirq/experiments/xeb_fitting.py,sha256=54FKzGqhZgyvAkP_AR2-7peDnL-PJxOp-MkQdfp8bfU,27178
|
|
202
202
|
cirq/experiments/xeb_fitting_test.py,sha256=nfFhKPr_Nx5rbfCcvrcUFQxphCZuTnJVnpT-xBjxRFI,14349
|
|
203
|
-
cirq/experiments/xeb_sampling.py,sha256=
|
|
203
|
+
cirq/experiments/xeb_sampling.py,sha256=6ZOidGi7Kt6p4cMQCjK7qQuIUXVHCYl47B2GnL8M-Bw,14987
|
|
204
204
|
cirq/experiments/xeb_sampling_test.py,sha256=0XkQGvcURsug3IblE_wZrHVDoOQV3WuQilrqCJbDHjI,6784
|
|
205
205
|
cirq/experiments/xeb_simulation.py,sha256=DpCWVxzWnZvjrdfgIbwR9rWenehqz7Su3LPIVHoK7gI,5055
|
|
206
206
|
cirq/experiments/xeb_simulation_test.py,sha256=gx0GqGZ4TDwrNW5ULK5JEWfzL-Dvb8TpAxIgdpiB8Tg,5430
|
|
@@ -1175,8 +1175,8 @@ cirq/work/sampler.py,sha256=JEAeQQRF3bqlO9AkOf4XbrTATDI5f5JgyM_FAUCNxao,19751
|
|
|
1175
1175
|
cirq/work/sampler_test.py,sha256=B2ZsuqGT854gQtBIAh8k0LiG9Vj5wSzcGvkxOUoTcW4,13217
|
|
1176
1176
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1177
1177
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1178
|
-
cirq_core-1.5.0.
|
|
1179
|
-
cirq_core-1.5.0.
|
|
1180
|
-
cirq_core-1.5.0.
|
|
1181
|
-
cirq_core-1.5.0.
|
|
1182
|
-
cirq_core-1.5.0.
|
|
1178
|
+
cirq_core-1.5.0.dev20240610203324.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1179
|
+
cirq_core-1.5.0.dev20240610203324.dist-info/METADATA,sha256=T_KZxLr9s0X7baudscpUcLSH_DKi_sHnXRObFG9lMnE,1998
|
|
1180
|
+
cirq_core-1.5.0.dev20240610203324.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
1181
|
+
cirq_core-1.5.0.dev20240610203324.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1182
|
+
cirq_core-1.5.0.dev20240610203324.dist-info/RECORD,,
|
{cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.5.0.dev20240607171515.dist-info → cirq_core-1.5.0.dev20240610203324.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|