cirq-core 1.5.0.dev20250211180327__py3-none-any.whl → 1.5.0.dev20250212192250__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.dev20250211180327"
31
+ __version__ = "1.5.0.dev20250212192250"
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.dev20250211180327"
6
+ assert cirq.__version__ == "1.5.0.dev20250212192250"
@@ -326,32 +326,42 @@ class CliffordTableau(StabilizerState):
326
326
  return string
327
327
 
328
328
  def _str_full_(self) -> str:
329
- string = ''
330
-
331
- string += 'stable' + ' ' * max(self.n * 2 - 3, 1)
332
- string += '| destable\n'
333
- string += '-' * max(7, self.n * 2 + 3) + '+' + '-' * max(10, self.n * 2 + 4) + '\n'
334
-
335
- for j in range(self.n):
336
- for i in [j + self.n, j]:
337
- string += '- ' if self.rs[i] else '+ '
338
-
339
- for k in range(self.n):
340
- if self.xs[i, k] & (not self.zs[i, k]):
341
- string += f'X{k}'
342
- elif (not self.xs[i, k]) & self.zs[i, k]:
343
- string += f'Z{k}'
344
- elif self.xs[i, k] & self.zs[i, k]:
345
- string += f'Y{k}'
346
- else:
347
- string += ' '
348
-
349
- if i == j + self.n:
350
- string += ' ' * max(0, 4 - self.n * 2) + ' | '
351
-
352
- string += '\n'
329
+ left_col_width = max(7, self.n * 2 + 3)
330
+ right_col_width = max(10, self.n * 2 + 4)
331
+
332
+ def _fill_row(left: str, right: str, mid='|', fill=' ') -> str:
333
+ """Builds a left-aligned fixed-width row with 2 columns."""
334
+ return f"{left:{fill}<{left_col_width}}{mid}{right:{fill}<{right_col_width}}".rstrip()
335
+
336
+ def _pauli_from_matrix(r: int, c: int) -> str:
337
+ match (bool(self.xs[r, c]), bool(self.zs[r, c])):
338
+ case (True, False):
339
+ return f'X{c}'
340
+ case (False, True):
341
+ return f'Z{c}'
342
+ case (True, True):
343
+ return f'Y{c}'
344
+ case _:
345
+ # (False, False) is the only leftover option
346
+ return ' '
347
+
348
+ title_row = _fill_row('stable', ' destable')
349
+ divider = _fill_row('', '', mid='+', fill='-')
350
+ contents = [
351
+ _fill_row(
352
+ left=(
353
+ f"{'-' if self.rs[i + self.n] else '+'} "
354
+ f"{''.join(_pauli_from_matrix(i + self.n, j) for j in range(self.n))}"
355
+ ),
356
+ right=(
357
+ f" {'-' if self.rs[i] else '+'} "
358
+ f"{''.join(_pauli_from_matrix(i, j) for j in range(self.n))}"
359
+ ),
360
+ )
361
+ for i in range(self.n)
362
+ ]
353
363
 
354
- return string
364
+ return '\n'.join([title_row, divider, *contents]) + '\n'
355
365
 
356
366
  def then(self, second: 'CliffordTableau') -> 'CliffordTableau':
357
367
  """Returns a composed CliffordTableau of this tableau and the second tableau.
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  """Tests for clifford tableau."""
16
+
16
17
  import numpy as np
17
18
  import pytest
18
19
 
@@ -308,7 +309,7 @@ def test_str_full():
308
309
  t = cirq.CliffordTableau(num_qubits=2)
309
310
  expected_str = r"""stable | destable
310
311
  -------+----------
311
- + Z0 | + X0
312
+ + Z0 | + X0
312
313
  + Z1 | + X1
313
314
  """
314
315
  assert t._str_full_() == expected_str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cirq-core
3
- Version: 1.5.0.dev20250211180327
3
+ Version: 1.5.0.dev20250212192250
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=oMg51Iy6CdjQEFxdzUuUkA7P891s_RRRn6JvuNMywoA,1206
8
- cirq/_version_test.py,sha256=CDmnF_CvDfMf8_APpFZ8VomuittJiA6Cz6lCFxSyY2U,147
7
+ cirq/_version.py,sha256=obO7BrWo8ufaC0jdNj8oTqkrWBlkivbmcaLGUSEpUzk,1206
8
+ cirq/_version_test.py,sha256=qHr56c63GGbb-NFFtUAbsengEP3boKrwKQDGETlvIpI,147
9
9
  cirq/conftest.py,sha256=X7yLFL8GLhg2CjPw0hp5e_dGASfvHx1-QT03aUbhKJw,1168
10
10
  cirq/json_resolver_cache.py,sha256=p-vEOa-8GQ2cFIAdze-kd6C1un1uRvtujVPljVKaHBg,13557
11
11
  cirq/py.typed,sha256=VFSlmh_lNwnaXzwY-ZuW-C2Ws5PkuDoVgBdNCs0jXJE,63
@@ -894,8 +894,8 @@ cirq/protocols/json_test_data/sympy.pi.repr,sha256=ZQS0my0esr3dWTZ3mWlqgR63uorPC
894
894
  cirq/qis/__init__.py,sha256=7yOctnS4jY-rTfV9fKMbddVh1m8GjZDf3_hx4A7ZOcM,2892
895
895
  cirq/qis/channels.py,sha256=AxKgLUbWLrb1pz9xLtSpYm_stjN-IWOwLFYC9YZSons,12798
896
896
  cirq/qis/channels_test.py,sha256=iqkSyfvx_c2ZpJKAVEsFyZRmKpzNrJsyFjHbaJUMqcQ,14454
897
- cirq/qis/clifford_tableau.py,sha256=IBjjRobDIaohp6CCYJGjzIb7LC4LSwzxpUaUwpxizn0,25681
898
- cirq/qis/clifford_tableau_test.py,sha256=Z-5YSysJw2H3AfgZxhptvUMr5GUjUFgPcAUdcust9Qk,18441
897
+ cirq/qis/clifford_tableau.py,sha256=-y4w_qFY1sWv4McIZ4tOYiTdGwwkrVy_DFkeI0_-9zw,26231
898
+ cirq/qis/clifford_tableau_test.py,sha256=sHmHC3APFc5tpAkSSpVsywVgvAnkg5cYcj8KQjifcBI,18440
899
899
  cirq/qis/entropy.py,sha256=H9WcGlTK0NBU3aOtRWS8HM53ghmUqLB4OXicbbmwJj0,3954
900
900
  cirq/qis/entropy_test.py,sha256=NUT7Otn14rkoBbuOI3_PRthUf5aYxfc5tafCv0_wETw,1672
901
901
  cirq/qis/measures.py,sha256=-e2mStl9882z4mbLwWtbdmmdJilmf6Ex2b_jSXhMX3c,12194
@@ -1202,8 +1202,8 @@ cirq/work/sampler.py,sha256=bE5tmVkcR6cZZMLETxDfHehdsYUMbx2RvBeIBetehI4,19187
1202
1202
  cirq/work/sampler_test.py,sha256=hL2UWx3dz2ukZVNxWftiKVvJcQoLplLZdQm-k1QcA40,13282
1203
1203
  cirq/work/zeros_sampler.py,sha256=x1C7cup66a43n-3tm8QjhiqJa07qcJW10FxNp9jJ59Q,2356
1204
1204
  cirq/work/zeros_sampler_test.py,sha256=JIkpBBFPJe5Ba4142vzogyWyboG1Q1ZAm0UVGgOoZn8,3279
1205
- cirq_core-1.5.0.dev20250211180327.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1206
- cirq_core-1.5.0.dev20250211180327.dist-info/METADATA,sha256=LevIcJEY1LPOgpprYTLP0eAv8OZkHbGXaaqt3YClAVo,4811
1207
- cirq_core-1.5.0.dev20250211180327.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1208
- cirq_core-1.5.0.dev20250211180327.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1209
- cirq_core-1.5.0.dev20250211180327.dist-info/RECORD,,
1205
+ cirq_core-1.5.0.dev20250212192250.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
1206
+ cirq_core-1.5.0.dev20250212192250.dist-info/METADATA,sha256=ZZ68HBcHYNugRmZWUTHFlkq3x65pPO7Tkwpa269Gcoc,4811
1207
+ cirq_core-1.5.0.dev20250212192250.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
1208
+ cirq_core-1.5.0.dev20250212192250.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
1209
+ cirq_core-1.5.0.dev20250212192250.dist-info/RECORD,,