cirq-core 1.5.0.dev20241212054034__py3-none-any.whl → 1.5.0.dev20241212215114__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
@@ -28,4 +28,4 @@ if sys.version_info < (3, 10, 0): # pragma: no cover
28
28
  'of cirq (e.g. "python -m pip install cirq==1.1.*")'
29
29
  )
30
30
 
31
- __version__ = "1.5.0.dev20241212054034"
31
+ __version__ = "1.5.0.dev20241212215114"
cirq/_version_test.py CHANGED
@@ -3,4 +3,4 @@ import cirq
3
3
 
4
4
 
5
5
  def test_version():
6
- assert cirq.__version__ == "1.5.0.dev20241212054034"
6
+ assert cirq.__version__ == "1.5.0.dev20241212215114"
@@ -250,6 +250,7 @@ def generate_library_of_2q_circuits(
250
250
  q0: 'cirq.Qid' = devices.LineQubit(0),
251
251
  q1: 'cirq.Qid' = devices.LineQubit(1),
252
252
  random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
253
+ tags: Sequence[Any] = (),
253
254
  ) -> List['cirq.Circuit']:
254
255
  """Generate a library of two-qubit Circuits.
255
256
 
@@ -266,6 +267,7 @@ def generate_library_of_2q_circuits(
266
267
  q0: The first qubit to use when constructing the circuits.
267
268
  q1: The second qubit to use when constructing the circuits
268
269
  random_state: A random state or seed used to deterministically sample the random circuits.
270
+ tags: Tags to add to the two qubit operations.
269
271
  """
270
272
  rs = value.parse_random_state(random_state)
271
273
  exponents = np.linspace(0, 7 / 4, 8)
@@ -278,7 +280,7 @@ def generate_library_of_2q_circuits(
278
280
  q0,
279
281
  q1,
280
282
  depth=max_cycle_depth,
281
- two_qubit_op_factory=lambda a, b, _: two_qubit_gate(a, b),
283
+ two_qubit_op_factory=lambda a, b, _: two_qubit_gate(a, b).with_tags(*tags),
282
284
  single_qubit_gates=single_qubit_gates,
283
285
  seed=rs,
284
286
  )
@@ -457,3 +457,20 @@ def _coupled_qubit_pairs(
457
457
  add_pair(cirq.GridQubit(qubit.row + 1, qubit.col))
458
458
 
459
459
  return pairs
460
+
461
+
462
+ def test_generate_library_of_2q_circuits_with_tags():
463
+ circuits = generate_library_of_2q_circuits(
464
+ n_library_circuits=5,
465
+ two_qubit_gate=cirq.FSimGate(3, 4),
466
+ max_cycle_depth=13,
467
+ random_state=9,
468
+ tags=('test_tag',),
469
+ )
470
+ assert len(circuits) == 5
471
+ for circuit in circuits:
472
+ for op in circuit.all_operations():
473
+ if cirq.num_qubits(op) == 1:
474
+ continue
475
+ assert op.tags == ('test_tag',)
476
+ assert op.gate == cirq.FSimGate(3, 4)
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  """Provides functions for running and analyzing two-qubit XEB experiments."""
16
- from typing import Sequence, TYPE_CHECKING, Optional, Tuple, Dict, cast, Mapping
16
+ from typing import Sequence, TYPE_CHECKING, Optional, Tuple, Dict, cast, Mapping, Any
17
17
 
18
18
  from dataclasses import dataclass
19
19
  from types import MappingProxyType
@@ -402,6 +402,7 @@ def parallel_xeb_workflow(
402
402
  pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
403
403
  pool: Optional['multiprocessing.pool.Pool'] = None,
404
404
  batch_size: int = 9,
405
+ tags: Sequence[Any] = (),
405
406
  **plot_kwargs,
406
407
  ) -> Tuple[pd.DataFrame, Sequence['cirq.Circuit'], pd.DataFrame]:
407
408
  """A utility method that runs the full XEB workflow.
@@ -422,6 +423,7 @@ def parallel_xeb_workflow(
422
423
  batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
423
424
  environments. The number of (circuit, cycle_depth) tasks to be run in each batch
424
425
  is given by this number.
426
+ tags: Tags to add to two qubit operations.
425
427
  **plot_kwargs: Arguments to be passed to 'plt.Axes.plot'.
426
428
 
427
429
  Returns:
@@ -450,6 +452,7 @@ def parallel_xeb_workflow(
450
452
  two_qubit_gate=entangling_gate,
451
453
  random_state=rs,
452
454
  max_cycle_depth=max(cycle_depths),
455
+ tags=tags,
453
456
  )
454
457
 
455
458
  combs_by_layer = rqcg.get_random_combinations_for_device(
@@ -488,6 +491,7 @@ def parallel_two_qubit_xeb(
488
491
  ax: Optional[plt.Axes] = None,
489
492
  pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
490
493
  batch_size: int = 9,
494
+ tags: Sequence[Any] = (),
491
495
  **plot_kwargs,
492
496
  ) -> TwoQubitXEBResult:
493
497
  """A convenience method that runs the full XEB workflow.
@@ -507,6 +511,7 @@ def parallel_two_qubit_xeb(
507
511
  batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
508
512
  environments. The number of (circuit, cycle_depth) tasks to be run in each batch
509
513
  is given by this number.
514
+ tags: Tags to add to two qubit operations.
510
515
  **plot_kwargs: Arguments to be passed to 'plt.Axes.plot'.
511
516
  Returns:
512
517
  A TwoQubitXEBResult object representing the results of the experiment.
@@ -525,6 +530,7 @@ def parallel_two_qubit_xeb(
525
530
  random_state=random_state,
526
531
  ax=ax,
527
532
  batch_size=batch_size,
533
+ tags=tags,
528
534
  **plot_kwargs,
529
535
  )
530
536
  return TwoQubitXEBResult(fit_exponential_decays(fids))
@@ -544,6 +550,7 @@ def run_rb_and_xeb(
544
550
  random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
545
551
  pairs: Optional[Sequence[tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
546
552
  batch_size: int = 9,
553
+ tags: Sequence[Any] = (),
547
554
  ) -> InferredXEBResult:
548
555
  """A convenience method that runs both RB and XEB workflows.
549
556
 
@@ -561,6 +568,7 @@ def run_rb_and_xeb(
561
568
  batch_size: We call `run_batch` on the sampler, which can speed up execution in certain
562
569
  environments. The number of (circuit, cycle_depth) tasks to be run in each batch
563
570
  is given by this number.
571
+ tags: Tags to add to two qubit operations.
564
572
 
565
573
  Returns:
566
574
  An InferredXEBResult object representing the results of the experiment.
@@ -590,6 +598,7 @@ def run_rb_and_xeb(
590
598
  n_combinations=xeb_combinations,
591
599
  random_state=random_state,
592
600
  batch_size=batch_size,
601
+ tags=tags,
593
602
  )
594
603
 
595
604
  return InferredXEBResult(rb, xeb)
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  """Provides a method to do z-phase calibration for excitation-preserving gates."""
16
- from typing import Union, Optional, Sequence, Tuple, Dict, TYPE_CHECKING
16
+ from typing import Union, Optional, Sequence, Tuple, Dict, TYPE_CHECKING, Any
17
17
  import multiprocessing
18
18
  import multiprocessing.pool
19
19
 
@@ -41,6 +41,8 @@ def z_phase_calibration_workflow(
41
41
  random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
42
42
  atol: float = 1e-3,
43
43
  num_workers_or_pool: Union[int, 'multiprocessing.pool.Pool'] = -1,
44
+ pairs: Optional[Sequence[Tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
45
+ tags: Sequence[Any] = (),
44
46
  ) -> Tuple[xeb_fitting.XEBCharacterizationResult, 'pd.DataFrame']:
45
47
  """Perform z-phase calibration for excitation-preserving gates.
46
48
 
@@ -77,6 +79,8 @@ def z_phase_calibration_workflow(
77
79
  A zero value means no multiprocessing.
78
80
  A positive integer value will create a pool with the given number of workers.
79
81
  A negative value will create pool with maximum number of workers.
82
+ pairs: Pairs to use. If not specified, use all pairs between adjacent qubits.
83
+ tags: Tags to add to two qubit operations.
80
84
  Returns:
81
85
  - An `XEBCharacterizationResult` object that contains the calibration result.
82
86
  - A `pd.DataFrame` comparing the before and after fidelities.
@@ -100,6 +104,8 @@ def z_phase_calibration_workflow(
100
104
  n_combinations=n_combinations,
101
105
  random_state=random_state,
102
106
  pool=pool,
107
+ tags=tags,
108
+ pairs=pairs,
103
109
  )
104
110
 
105
111
  if options is None:
@@ -148,6 +154,8 @@ def calibrate_z_phases(
148
154
  random_state: 'cirq.RANDOM_STATE_OR_SEED_LIKE' = None,
149
155
  atol: float = 1e-3,
150
156
  num_workers_or_pool: Union[int, 'multiprocessing.pool.Pool'] = -1,
157
+ pairs: Optional[Sequence[Tuple['cirq.GridQubit', 'cirq.GridQubit']]] = None,
158
+ tags: Sequence[Any] = (),
151
159
  ) -> Dict[Tuple['cirq.Qid', 'cirq.Qid'], 'cirq.PhasedFSimGate']:
152
160
  """Perform z-phase calibration for excitation-preserving gates.
153
161
 
@@ -184,6 +192,8 @@ def calibrate_z_phases(
184
192
  A zero value means no multiprocessing.
185
193
  A positive integer value will create a pool with the given number of workers.
186
194
  A negative value will create pool with maximum number of workers.
195
+ pairs: Pairs to use. If not specified, use all pairs between adjacent qubits.
196
+ tags: Tags to add to two qubit operations.
187
197
 
188
198
  Returns:
189
199
  - A dictionary mapping qubit pairs to the calibrated PhasedFSimGates.
@@ -210,6 +220,8 @@ def calibrate_z_phases(
210
220
  random_state=random_state,
211
221
  atol=atol,
212
222
  num_workers_or_pool=num_workers_or_pool,
223
+ tags=tags,
224
+ pairs=pairs,
213
225
  )
214
226
 
215
227
  gates = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20241212054034
3
+ Version: 1.5.0.dev20241212215114
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
@@ -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=IZYUEECeUnxM2_xqj683n30g6TRjUuFel3MIUCfyTnw,1206
8
- cirq/_version_test.py,sha256=so_Y1Ye6tSdpLO3ef4ROGxc6hZYRKIRt40QO94joPmw,147
7
+ cirq/_version.py,sha256=aGP1JhtXlMjTZblfy8MQzDBqDX1jYeysNI3C-DDMZhE,1206
8
+ cirq/_version_test.py,sha256=4fgGlo2cdvDlbP43KTyox6Zzxkv7Zf70-KUXxtPEWGs,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=03MVo6Y-UYrzt9CKHmwpiBLN2ixL6uSU-OWnKZXfG7k,13302
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -185,8 +185,8 @@ cirq/experiments/purity_estimation.py,sha256=6D1UwFlQRzHeajXMTyTUfBYAc0jJQ8Cfz4l
185
185
  cirq/experiments/purity_estimation_test.py,sha256=xlBGp0NOBYR0IhTy3bckHPgi81FkGSGxKqk9hwXG-I8,923
186
186
  cirq/experiments/qubit_characterizations.py,sha256=-a-krc7Pw68VjsVvQmeZ92oXrpeME31j4cVrAkKFkr4,36730
187
187
  cirq/experiments/qubit_characterizations_test.py,sha256=b_ONqxyW6s01Ts8T65BEdb4e8Xy24Qp4zTGXWesL0ic,9733
188
- cirq/experiments/random_quantum_circuit_generation.py,sha256=GIA4qdrgECcZlvGOiWtKL0hGyuNJbRtzhrzPJXKI0iQ,28167
189
- cirq/experiments/random_quantum_circuit_generation_test.py,sha256=1rvgN8-Ajedn_70FyYKVzjvzR6NVpHj6KQgo6tra-Jc,15995
188
+ cirq/experiments/random_quantum_circuit_generation.py,sha256=tTgo1mEbLhY8i9VzR-p6xPqnv-O62TlJyW8AGj4V56M,28269
189
+ cirq/experiments/random_quantum_circuit_generation_test.py,sha256=zOWsLLcYefG0yA1rKn-hwdNjNANBXDaKg4vAUXPIwHk,16522
190
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
@@ -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=BxGKj0yVPSwgdDIwNXMGUhEmb9BfjvFS6HYsTTKFlcQ,22482
198
+ cirq/experiments/two_qubit_xeb.py,sha256=G6e6l9H0Jd6fo_DmgWZFCVIe9w34IpAK31q-Vj7K5IA,22787
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
@@ -203,7 +203,7 @@ cirq/experiments/xeb_sampling.py,sha256=6ZOidGi7Kt6p4cMQCjK7qQuIUXVHCYl47B2GnL8M
203
203
  cirq/experiments/xeb_sampling_test.py,sha256=0XkQGvcURsug3IblE_wZrHVDoOQV3WuQilrqCJbDHjI,6784
204
204
  cirq/experiments/xeb_simulation.py,sha256=yML2NAnYTRFG1wsQHvxtNEGEMXuExbWjrE2JYuCqnrk,5076
205
205
  cirq/experiments/xeb_simulation_test.py,sha256=YWFKXPdtBFuZNhQoG06W1EetVhXighc3zyXwhKfGAeo,5652
206
- cirq/experiments/z_phase_calibration.py,sha256=zKfxMg9X8u_wuBfABttOu83ZDa0eF6pJscFHtA4plPM,11303
206
+ cirq/experiments/z_phase_calibration.py,sha256=6N83Ky3zkhT5LMKx0TqNe2UAQbb-rp4nzuTG31GFELg,11884
207
207
  cirq/experiments/z_phase_calibration_test.py,sha256=Hk6FR-mvlkwol1WQvc75gw6oC_adRW-0_JF5y0X598E,7592
208
208
  cirq/interop/__init__.py,sha256=Xt1xU9UegP_jBNa9xaeOFSgtC0lYb_HNHq4hQQ0J20k,784
209
209
  cirq/interop/quirk/__init__.py,sha256=W11jqaExSgvoUkjM_d0Kik4R8bqETF9Ezo27CDEB3iw,1237
@@ -1189,8 +1189,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1189
1189
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1190
1190
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1191
1191
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1192
- cirq_core-1.5.0.dev20241212054034.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
- cirq_core-1.5.0.dev20241212054034.dist-info/METADATA,sha256=LSylyzFlTbTnlDRzjBoKwGnqqclAMNSomDqHWeMb7Z0,1992
1194
- cirq_core-1.5.0.dev20241212054034.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
- cirq_core-1.5.0.dev20241212054034.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
- cirq_core-1.5.0.dev20241212054034.dist-info/RECORD,,
1192
+ cirq_core-1.5.0.dev20241212215114.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
+ cirq_core-1.5.0.dev20241212215114.dist-info/METADATA,sha256=jYxnxWFXFL-_Mk17l3D7aztlymSWwprWNQ-Vwc7HC54,1992
1194
+ cirq_core-1.5.0.dev20241212215114.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
+ cirq_core-1.5.0.dev20241212215114.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
+ cirq_core-1.5.0.dev20241212215114.dist-info/RECORD,,