cirq-core 1.5.0.dev20250102040807__py3-none-any.whl → 1.5.0.dev20250104153038__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.dev20250102040807"
31
+ __version__ = "1.5.0.dev20250104153038"
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.dev20250102040807"
6
+ assert cirq.__version__ == "1.5.0.dev20250104153038"
cirq/circuits/circuit.py CHANGED
@@ -2010,6 +2010,24 @@ class Circuit(AbstractCircuit):
2010
2010
  ) -> 'cirq.Circuit':
2011
2011
  """Returns the same circuit, but with different qubits.
2012
2012
 
2013
+ This function will return a new `Circuit` with the same gates but
2014
+ with qubits mapped according to the argument.
2015
+
2016
+ For example, the following will translate LineQubits to GridQubits:
2017
+
2018
+ >>> grid_qubits = cirq.GridQubit.square(2)
2019
+ >>> line_qubits = cirq.LineQubit.range(4)
2020
+ >>> circuit = cirq.Circuit([cirq.H(q) for q in line_qubits])
2021
+ >>> circuit.transform_qubits(lambda q : grid_qubits[q.x])
2022
+ cirq.Circuit([
2023
+ cirq.Moment(
2024
+ cirq.H(cirq.GridQubit(0, 0)),
2025
+ cirq.H(cirq.GridQubit(0, 1)),
2026
+ cirq.H(cirq.GridQubit(1, 0)),
2027
+ cirq.H(cirq.GridQubit(1, 1)),
2028
+ ),
2029
+ ])
2030
+
2013
2031
  Args:
2014
2032
  qubit_map: A function or a dict mapping each current qubit into a desired
2015
2033
  new qubit.
cirq/ops/raw_types.py CHANGED
@@ -566,6 +566,26 @@ class Operation(metaclass=abc.ABCMeta):
566
566
  ) -> Self:
567
567
  """Returns the same operation, but with different qubits.
568
568
 
569
+ This function will return a new operation with the same gate but
570
+ with qubits mapped according to the argument.
571
+
572
+ For example, the following will translate LineQubits to GridQubits
573
+ using a grid with 4 columns:
574
+
575
+ >>> op = cirq.CZ(cirq.LineQubit(5), cirq.LineQubit(9))
576
+ >>> op.transform_qubits(lambda q: cirq.GridQubit(q.x // 4, q.x % 4))
577
+ cirq.CZ(cirq.GridQubit(1, 1), cirq.GridQubit(2, 1))
578
+
579
+ This can also be used with a dictionary that has a mapping, such
580
+ as the following which maps named qubits to line qubits:
581
+
582
+ >>> a = cirq.NamedQubit('alice')
583
+ >>> b = cirq.NamedQubit('bob')
584
+ >>> d = {a: cirq.LineQubit(4), b: cirq.LineQubit(5)}
585
+ >>> op = cirq.CNOT(a, b)
586
+ >>> op.transform_qubits(d)
587
+ cirq.CNOT(cirq.LineQubit(4), cirq.LineQubit(5))
588
+
569
589
  Args:
570
590
  qubit_map: A function or a dict mapping each current qubit into a desired
571
591
  new qubit.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250102040807
3
+ Version: 1.5.0.dev20250104153038
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=aflr3WOMzKIxPSlz2CaNXuXOOs8Tm7BVT-Jn6UJhqL4,1206
8
- cirq/_version_test.py,sha256=M1BB1BtGG8H14GutX2gYEDoj26nJB6LFzr_2rBqn2oA,147
7
+ cirq/_version.py,sha256=-iOI9womEA9EhbNaUnDjmWP7vgW5t_5_soq0QwvE6OY,1206
8
+ cirq/_version_test.py,sha256=YyY-DlBsqPbz0RTWgPug8z_oSmTzFSvPEEBBqU5VUlY,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
@@ -16,7 +16,7 @@ cirq/circuits/_box_drawing_character_data.py,sha256=QLoCXwcLL7091RdxEKO259goxt4R
16
16
  cirq/circuits/_box_drawing_character_data_test.py,sha256=XO94z0piwZRHaNZHTf-5tKHQ4MKcDruMeRIKdT8GbYA,1624
17
17
  cirq/circuits/_bucket_priority_queue.py,sha256=hxFuii2fKD8G6EKT_aVLEsA7FmSfqFXPwIbA0KsoSC4,6745
18
18
  cirq/circuits/_bucket_priority_queue_test.py,sha256=t6u_hG7K2e2WKWrgCsKxNRtp4ghKwiCrp0_WSY0W25k,5288
19
- cirq/circuits/circuit.py,sha256=nM3Ie2qSGJN1fZ-1HCKpjhUVoW8JBZFT0rNW3iCSTM0,115150
19
+ cirq/circuits/circuit.py,sha256=mSchbaJudEfwqpLj6x0He54d8GhyiE7nqA2RTx8Zw6c,115851
20
20
  cirq/circuits/circuit_operation.py,sha256=3CfJd7zhEMub792vgb2VO545rsj68yX_YEYMirySI3U,34705
21
21
  cirq/circuits/circuit_operation_test.py,sha256=u-23dDZ6htNSiP8oXR67rmtb-XDBmObvbJjJrARhmis,44646
22
22
  cirq/circuits/circuit_test.py,sha256=1YMXK7wHcct-HK7MKH8lE63pQQ80-jCghVAsG0DsXpU,160524
@@ -359,7 +359,7 @@ cirq/ops/qubit_order_or_list.py,sha256=WVnhQcOYCgAhiB4t47Kji-pN1tnvs--X5deCQwwGV
359
359
  cirq/ops/qubit_order_test.py,sha256=B9xMIxlaI7YjRUNA6AkHJuUCFejGYw-lT7ZaSl31yTU,4238
360
360
  cirq/ops/random_gate_channel.py,sha256=gKDqZa6AwdCIuuh2UOvO5oxCdGRDOInA7fI3ZLQ-LTY,5121
361
361
  cirq/ops/random_gate_channel_test.py,sha256=U3EAaAlCZkgFIYxqwcSkPsaVGrKA2PSeG_DK2ou--AE,8606
362
- cirq/ops/raw_types.py,sha256=ISnjY0TPcle_qe6uzHCF_4d_SQevJ4lSWJWGR36lYuU,40309
362
+ cirq/ops/raw_types.py,sha256=NbzQA7er7T8Un9TrMzc61abqASSTcMFkVxhnav_09Vw,41156
363
363
  cirq/ops/raw_types_test.py,sha256=bZUOQSfPDZgH6Z98PKX0oBP2iWXwSh3b9dty1dFcFfM,33620
364
364
  cirq/ops/state_preparation_channel.py,sha256=PjVtoLbjBAy_XqnFAY40Am-NifeuCFVVLW6RJxph5sQ,4778
365
365
  cirq/ops/state_preparation_channel_test.py,sha256=yKUvLw_ft6cvIgRJcFQ779wZS-V6V-pzQq-rZRWdCmU,5922
@@ -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.dev20250102040807.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
- cirq_core-1.5.0.dev20250102040807.dist-info/METADATA,sha256=x96JMXaGS4HF_k6ltmT9tGHtTNnVaB-VhYGqGeJYmDQ,1992
1194
- cirq_core-1.5.0.dev20250102040807.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
- cirq_core-1.5.0.dev20250102040807.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
- cirq_core-1.5.0.dev20250102040807.dist-info/RECORD,,
1192
+ cirq_core-1.5.0.dev20250104153038.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1193
+ cirq_core-1.5.0.dev20250104153038.dist-info/METADATA,sha256=bPLGpw53sZnz8T1J4sjJ5wcICSe9tbGVSJ40K6crZbA,1992
1194
+ cirq_core-1.5.0.dev20250104153038.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1195
+ cirq_core-1.5.0.dev20250104153038.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1196
+ cirq_core-1.5.0.dev20250104153038.dist-info/RECORD,,