cirq-core 1.5.0.dev20241122145042__py3-none-any.whl → 1.5.0.dev20241202173736__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/experiments/readout_confusion_matrix.py +6 -22
- cirq/experiments/two_qubit_xeb.py +15 -0
- {cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/METADATA +1 -1
- {cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/RECORD +9 -9
- {cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/WHEEL +1 -1
- {cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
|
@@ -26,20 +26,6 @@ if TYPE_CHECKING:
|
|
|
26
26
|
import cirq
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def _mitigate_single_bitstring(z_rinv_all: list[np.ndarray], bitstring: np.ndarray) -> float:
|
|
30
|
-
"""Return the mitigated Pauli expectation value for a single observed bitstring.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
z_rinv_all: A list of single-qubit pauli-Z (as a vector) contracted with the single-qubit
|
|
34
|
-
inverse response matrix, for each qubit.
|
|
35
|
-
bitstring: The measured bitstring.
|
|
36
|
-
|
|
37
|
-
Returns:
|
|
38
|
-
The corrected expectation value of ZZZZZ... given the single measured bitstring.
|
|
39
|
-
"""
|
|
40
|
-
return np.prod([z_rinv[bit] for z_rinv, bit in zip(z_rinv_all, bitstring)])
|
|
41
|
-
|
|
42
|
-
|
|
43
29
|
class TensoredConfusionMatrices:
|
|
44
30
|
"""Store and use confusion matrices for readout error mitigation on sets of qubits.
|
|
45
31
|
|
|
@@ -348,7 +334,10 @@ class TensoredConfusionMatrices:
|
|
|
348
334
|
confusion matrices for all of `qubits`.
|
|
349
335
|
"""
|
|
350
336
|
|
|
351
|
-
#
|
|
337
|
+
# in case given as an array of bools, convert to an array of ints:
|
|
338
|
+
measured_bitstrings = measured_bitstrings.astype(int)
|
|
339
|
+
|
|
340
|
+
# get all of the confusion matrices
|
|
352
341
|
cm_all = []
|
|
353
342
|
for qubit in qubits:
|
|
354
343
|
try:
|
|
@@ -365,15 +354,10 @@ class TensoredConfusionMatrices:
|
|
|
365
354
|
|
|
366
355
|
# next, contract them with the single-qubit Pauli operators:
|
|
367
356
|
z = np.array([1, -1])
|
|
368
|
-
z_cminv_all = [z @ cminv for cminv in cminv_all]
|
|
357
|
+
z_cminv_all = np.array([z @ cminv for cminv in cminv_all])
|
|
369
358
|
|
|
370
359
|
# finally, mitigate each bitstring:
|
|
371
|
-
z_mit_all_shots = np.
|
|
372
|
-
[
|
|
373
|
-
_mitigate_single_bitstring(z_cminv_all, bitstring)
|
|
374
|
-
for bitstring in measured_bitstrings
|
|
375
|
-
]
|
|
376
|
-
)
|
|
360
|
+
z_mit_all_shots = np.prod(np.einsum("iji->ij", z_cminv_all[:, measured_bitstrings]), axis=0)
|
|
377
361
|
|
|
378
362
|
# return mean and statistical uncertainty:
|
|
379
363
|
return np.mean(z_mit_all_shots), np.std(z_mit_all_shots) / np.sqrt(len(measured_bitstrings))
|
|
@@ -401,6 +401,7 @@ def parallel_xeb_workflow(
|
|
|
401
401
|
ax: Optional[plt.Axes] = None,
|
|
402
402
|
pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
|
|
403
403
|
pool: Optional['multiprocessing.pool.Pool'] = None,
|
|
404
|
+
batch_size: int = 9,
|
|
404
405
|
**plot_kwargs,
|
|
405
406
|
) -> Tuple[pd.DataFrame, Sequence['cirq.Circuit'], pd.DataFrame]:
|
|
406
407
|
"""A utility method that runs the full XEB workflow.
|
|
@@ -418,6 +419,9 @@ def parallel_xeb_workflow(
|
|
|
418
419
|
no plot is created.
|
|
419
420
|
pairs: Pairs to use. If not specified, use all pairs between adjacent qubits.
|
|
420
421
|
pool: An optional multiprocessing pool.
|
|
422
|
+
batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
|
|
423
|
+
environments. The number of (circuit, cycle_depth) tasks to be run in each batch
|
|
424
|
+
is given by this number.
|
|
421
425
|
**plot_kwargs: Arguments to be passed to 'plt.Axes.plot'.
|
|
422
426
|
|
|
423
427
|
Returns:
|
|
@@ -462,6 +466,7 @@ def parallel_xeb_workflow(
|
|
|
462
466
|
combinations_by_layer=combs_by_layer,
|
|
463
467
|
shuffle=rs,
|
|
464
468
|
repetitions=n_repetitions,
|
|
469
|
+
batch_size=batch_size,
|
|
465
470
|
)
|
|
466
471
|
|
|
467
472
|
fids = benchmark_2q_xeb_fidelities(
|
|
@@ -482,6 +487,7 @@ def parallel_two_qubit_xeb(
|
|
|
482
487
|
random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
|
|
483
488
|
ax: Optional[plt.Axes] = None,
|
|
484
489
|
pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
|
|
490
|
+
batch_size: int = 9,
|
|
485
491
|
**plot_kwargs,
|
|
486
492
|
) -> TwoQubitXEBResult:
|
|
487
493
|
"""A convenience method that runs the full XEB workflow.
|
|
@@ -498,6 +504,9 @@ def parallel_two_qubit_xeb(
|
|
|
498
504
|
ax: the plt.Axes to plot the device layout on. If not given,
|
|
499
505
|
no plot is created.
|
|
500
506
|
pairs: Pairs to use. If not specified, use all pairs between adjacent qubits.
|
|
507
|
+
batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
|
|
508
|
+
environments. The number of (circuit, cycle_depth) tasks to be run in each batch
|
|
509
|
+
is given by this number.
|
|
501
510
|
**plot_kwargs: Arguments to be passed to 'plt.Axes.plot'.
|
|
502
511
|
Returns:
|
|
503
512
|
A TwoQubitXEBResult object representing the results of the experiment.
|
|
@@ -515,6 +524,7 @@ def parallel_two_qubit_xeb(
|
|
|
515
524
|
cycle_depths=cycle_depths,
|
|
516
525
|
random_state=random_state,
|
|
517
526
|
ax=ax,
|
|
527
|
+
batch_size=batch_size,
|
|
518
528
|
**plot_kwargs,
|
|
519
529
|
)
|
|
520
530
|
return TwoQubitXEBResult(fit_exponential_decays(fids))
|
|
@@ -533,6 +543,7 @@ def run_rb_and_xeb(
|
|
|
533
543
|
xeb_combinations: int = 10,
|
|
534
544
|
random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
|
|
535
545
|
pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
|
|
546
|
+
batch_size: int = 9,
|
|
536
547
|
) -> InferredXEBResult:
|
|
537
548
|
"""A convenience method that runs both RB and XEB workflows.
|
|
538
549
|
|
|
@@ -547,6 +558,9 @@ def run_rb_and_xeb(
|
|
|
547
558
|
xeb_combinations: The number of combinations to generate for XEB.
|
|
548
559
|
random_state: The random state to use.
|
|
549
560
|
pairs: Pairs to use. If not specified, use all pairs between adjacent qubits.
|
|
561
|
+
batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
|
|
562
|
+
environments. The number of (circuit, cycle_depth) tasks to be run in each batch
|
|
563
|
+
is given by this number.
|
|
550
564
|
|
|
551
565
|
Returns:
|
|
552
566
|
An InferredXEBResult object representing the results of the experiment.
|
|
@@ -575,6 +589,7 @@ def run_rb_and_xeb(
|
|
|
575
589
|
cycle_depths=depths_xeb,
|
|
576
590
|
n_combinations=xeb_combinations,
|
|
577
591
|
random_state=random_state,
|
|
592
|
+
batch_size=batch_size,
|
|
578
593
|
)
|
|
579
594
|
|
|
580
595
|
return InferredXEBResult(rb, xeb)
|
{cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.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.dev20241202173736
|
|
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.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.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=D6ynQI7ZeYrM6zXi6qSIFLkR_6N_rGTA-f61a98H3fw,1206
|
|
8
|
+
cirq/_version_test.py,sha256=Sr-dEUA2hgJJeoRDnfwRTiJ499KTmE_PU86Nl6_tLgo,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
|
|
@@ -187,7 +187,7 @@ cirq/experiments/qubit_characterizations.py,sha256=-a-krc7Pw68VjsVvQmeZ92oXrpeME
|
|
|
187
187
|
cirq/experiments/qubit_characterizations_test.py,sha256=b_ONqxyW6s01Ts8T65BEdb4e8Xy24Qp4zTGXWesL0ic,9733
|
|
188
188
|
cirq/experiments/random_quantum_circuit_generation.py,sha256=GIA4qdrgECcZlvGOiWtKL0hGyuNJbRtzhrzPJXKI0iQ,28167
|
|
189
189
|
cirq/experiments/random_quantum_circuit_generation_test.py,sha256=1rvgN8-Ajedn_70FyYKVzjvzR6NVpHj6KQgo6tra-Jc,15995
|
|
190
|
-
cirq/experiments/readout_confusion_matrix.py,sha256=
|
|
190
|
+
cirq/experiments/readout_confusion_matrix.py,sha256=5yS7VXDe9LHYn_6YRYek-HZ9ftEBmCTn5__TYSUONGQ,20875
|
|
191
191
|
cirq/experiments/readout_confusion_matrix_test.py,sha256=ETvKHVuJWvq8KuL0l6w22UOfZHhBNH-TVeWAKqjSQEc,10632
|
|
192
192
|
cirq/experiments/single_qubit_readout_calibration.py,sha256=x6fF6GqU1D4YY05YvW1DFlTlbjC12_bfj7W2psd75-U,14722
|
|
193
193
|
cirq/experiments/single_qubit_readout_calibration_test.py,sha256=_002QXj2rIFHkH3vw9iTVMh45vCPuCI_fTqOUK8uMe4,7718
|
|
@@ -195,7 +195,7 @@ cirq/experiments/t1_decay_experiment.py,sha256=ealdmc_RTE__z1YUcaDEncDzQOaiT0K6I
|
|
|
195
195
|
cirq/experiments/t1_decay_experiment_test.py,sha256=Pgbm-37JiCdw9iQg2OaXVvs72xGWV2629CgsTQlLQnw,9139
|
|
196
196
|
cirq/experiments/t2_decay_experiment.py,sha256=lTgZ9yJ7Fk9_ozUCHysQn1qKrMQwTpsgEv-QnvsEif0,19158
|
|
197
197
|
cirq/experiments/t2_decay_experiment_test.py,sha256=DFR0BGn0Id4qNPfqIExj70TEAqf7Vrc8eK91Wj0YKTc,15031
|
|
198
|
-
cirq/experiments/two_qubit_xeb.py,sha256=
|
|
198
|
+
cirq/experiments/two_qubit_xeb.py,sha256=BxGKj0yVPSwgdDIwNXMGUhEmb9BfjvFS6HYsTTKFlcQ,22482
|
|
199
199
|
cirq/experiments/two_qubit_xeb_test.py,sha256=wJi-ulxtSJyE5pzJPoUgoV8X2NLZG_H0jlW1JKHSo_I,10681
|
|
200
200
|
cirq/experiments/xeb_fitting.py,sha256=Tzo2kg62udpRp654XArSDVcyVNhlhkNmpx9UVyxZiiw,30337
|
|
201
201
|
cirq/experiments/xeb_fitting_test.py,sha256=0GQ6ifSWdvEJ6-ICIcSR-R9lFLRwBykgf6toLElmg0o,15483
|
|
@@ -1187,8 +1187,8 @@ cirq/work/sampler.py,sha256=y6qtCpAwO8SqZ_JKU8PwlbMLHpJskNPqGWD_pNbyZew,19779
|
|
|
1187
1187
|
cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
|
|
1188
1188
|
cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
|
|
1189
1189
|
cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
|
|
1190
|
-
cirq_core-1.5.0.
|
|
1191
|
-
cirq_core-1.5.0.
|
|
1192
|
-
cirq_core-1.5.0.
|
|
1193
|
-
cirq_core-1.5.0.
|
|
1194
|
-
cirq_core-1.5.0.
|
|
1190
|
+
cirq_core-1.5.0.dev20241202173736.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1191
|
+
cirq_core-1.5.0.dev20241202173736.dist-info/METADATA,sha256=BE-y8tWJvMo_4Yld-zhiah3vLNiyVNm9YG_RpQb4VBk,1992
|
|
1192
|
+
cirq_core-1.5.0.dev20241202173736.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1193
|
+
cirq_core-1.5.0.dev20241202173736.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1194
|
+
cirq_core-1.5.0.dev20241202173736.dist-info/RECORD,,
|
{cirq_core-1.5.0.dev20241122145042.dist-info → cirq_core-1.5.0.dev20241202173736.dist-info}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|