cirq-core 1.5.0.dev20250211223123__py3-none-any.whl → 1.5.0.dev20250212202822__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/ops/clifford_gate.py +1 -1
- cirq/ops/clifford_gate_test.py +39 -1
- cirq/qis/clifford_tableau.py +35 -25
- cirq/qis/clifford_tableau_test.py +2 -1
- {cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/METADATA +1 -1
- {cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/RECORD +11 -11
- {cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/WHEEL +0 -0
- {cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
cirq/ops/clifford_gate.py
CHANGED
|
@@ -433,7 +433,7 @@ class CliffordGate(raw_types.Gate, CommonCliffordGates):
|
|
|
433
433
|
return CliffordGate.from_clifford_tableau(base_tableau)
|
|
434
434
|
|
|
435
435
|
def __repr__(self) -> str:
|
|
436
|
-
return f"Clifford Gate with Tableau:\n
|
|
436
|
+
return f"Clifford Gate with Tableau:\n{self.clifford_tableau._str_full_()}"
|
|
437
437
|
|
|
438
438
|
def _commutes_(
|
|
439
439
|
self, other: Any, *, atol: float = 1e-8
|
cirq/ops/clifford_gate_test.py
CHANGED
|
@@ -923,7 +923,31 @@ def test_all_single_qubit_clifford_unitaries():
|
|
|
923
923
|
assert cirq.equal_up_to_global_phase(cs[23], (i - 1j * (-x - y - z)) / 2)
|
|
924
924
|
|
|
925
925
|
|
|
926
|
+
def test_clifford_gate_repr():
|
|
927
|
+
q0, q1, q2 = cirq.LineQubit.range(3)
|
|
928
|
+
assert (
|
|
929
|
+
repr(cirq.ops.CliffordGate.from_op_list([cirq.ops.X(q0), cirq.CZ(q1, q2)], [q0, q1, q2]))
|
|
930
|
+
== """Clifford Gate with Tableau:
|
|
931
|
+
stable | destable
|
|
932
|
+
---------+----------
|
|
933
|
+
- Z0 | + X0
|
|
934
|
+
+ Z1 | + X1Z2
|
|
935
|
+
+ Z2 | + Z1X2
|
|
936
|
+
"""
|
|
937
|
+
)
|
|
938
|
+
assert (
|
|
939
|
+
repr(cirq.ops.CliffordGate.CNOT)
|
|
940
|
+
== """Clifford Gate with Tableau:
|
|
941
|
+
stable | destable
|
|
942
|
+
-------+----------
|
|
943
|
+
+ Z0 | + X0X1
|
|
944
|
+
+ Z0Z1 | + X1
|
|
945
|
+
"""
|
|
946
|
+
)
|
|
947
|
+
|
|
948
|
+
|
|
926
949
|
def test_single_qubit_clifford_gate_repr():
|
|
950
|
+
# Common gates
|
|
927
951
|
assert repr(cirq.ops.SingleQubitCliffordGate.X) == (
|
|
928
952
|
'cirq.ops.SingleQubitCliffordGate(_clifford_tableau=cirq.CliffordTableau(1, '
|
|
929
953
|
'rs=np.array([False, True]), xs=np.array([[True], [False]]), '
|
|
@@ -950,8 +974,22 @@ def test_single_qubit_clifford_gate_repr():
|
|
|
950
974
|
'zs=np.array([[False], [True]])))'
|
|
951
975
|
)
|
|
952
976
|
|
|
953
|
-
assert
|
|
977
|
+
assert repr(cirq.ops.SingleQubitCliffordGate.X) == (
|
|
954
978
|
'cirq.ops.SingleQubitCliffordGate(_clifford_tableau=cirq.CliffordTableau(1, '
|
|
955
979
|
'rs=np.array([False, True]), xs=np.array([[True], [False]]), '
|
|
956
980
|
'zs=np.array([[False], [True]])))'
|
|
957
981
|
)
|
|
982
|
+
|
|
983
|
+
# Other gates
|
|
984
|
+
qa = cirq.NamedQubit('a')
|
|
985
|
+
gate = cirq.ops.SingleQubitCliffordGate.from_clifford_tableau(
|
|
986
|
+
cirq.ops.CliffordGate.from_op_list(
|
|
987
|
+
[cirq.ops.PhasedXZGate(axis_phase_exponent=0.25, x_exponent=-1, z_exponent=0).on(qa)],
|
|
988
|
+
[qa],
|
|
989
|
+
).clifford_tableau
|
|
990
|
+
)
|
|
991
|
+
assert repr(gate) == (
|
|
992
|
+
'cirq.ops.SingleQubitCliffordGate(_clifford_tableau=cirq.CliffordTableau(1, '
|
|
993
|
+
'rs=np.array([False, True]), xs=np.array([[True], [False]]), '
|
|
994
|
+
'zs=np.array([[True], [True]])))'
|
|
995
|
+
)
|
cirq/qis/clifford_tableau.py
CHANGED
|
@@ -326,32 +326,42 @@ class CliffordTableau(StabilizerState):
|
|
|
326
326
|
return string
|
|
327
327
|
|
|
328
328
|
def _str_full_(self) -> str:
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
|
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
|
{cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.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.dev20250212202822
|
|
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.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.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=KhFvU-esnBbx41Kz8qXxH2mVWcFA00oTGitSfszG2yI,1206
|
|
8
|
+
cirq/_version_test.py,sha256=WpcUUGvQqnigxkU4eWcTNaHjkkZUVUKJXyl6p-V9ZOY,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
|
|
@@ -271,8 +271,8 @@ cirq/ops/boolean_hamiltonian.py,sha256=li003lNq6zS8pNPTobqzfzYJvyvaIpCVo3wkliI6H
|
|
|
271
271
|
cirq/ops/boolean_hamiltonian_test.py,sha256=1ey5yfYZPKZDsfM3jpCPAOpbPs_y8i4K_WvDK2d5_4Y,8518
|
|
272
272
|
cirq/ops/classically_controlled_operation.py,sha256=M4NAcChYcz-a88oyIwOnV4uP06S18Cbef4VnhMmjyrA,10374
|
|
273
273
|
cirq/ops/classically_controlled_operation_test.py,sha256=nIYyXfNH4E2IibZSLk6QDVHpfJQbuI_iWwirCH8rhi8,50209
|
|
274
|
-
cirq/ops/clifford_gate.py,sha256=
|
|
275
|
-
cirq/ops/clifford_gate_test.py,sha256=
|
|
274
|
+
cirq/ops/clifford_gate.py,sha256=usI1Qs2RiTZyrD8OP2zptcJIamzi8EZcRglsYofKY5A,39749
|
|
275
|
+
cirq/ops/clifford_gate_test.py,sha256=MQzZRURV--SPjRGLk_ESMBz75YXtKwtQGg2jufFDR0w,40341
|
|
276
276
|
cirq/ops/common_channels.py,sha256=go4yhaRw0XNAr3TUBJ59SOhn2SKxf6bHmmrOHPbBYCY,37259
|
|
277
277
|
cirq/ops/common_channels_test.py,sha256=nQsSSxu7vtedb3ZUuw4hNKIX7MYI4x8lxvLyWMZNt10,30079
|
|
278
278
|
cirq/ops/common_gate_families.py,sha256=e5M8wlDYtdrpWBrhdns6iizIvSqzfxDyIsBdxt8hVMc,8611
|
|
@@ -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
|
|
898
|
-
cirq/qis/clifford_tableau_test.py,sha256=
|
|
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.
|
|
1206
|
-
cirq_core-1.5.0.
|
|
1207
|
-
cirq_core-1.5.0.
|
|
1208
|
-
cirq_core-1.5.0.
|
|
1209
|
-
cirq_core-1.5.0.
|
|
1205
|
+
cirq_core-1.5.0.dev20250212202822.dist-info/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
1206
|
+
cirq_core-1.5.0.dev20250212202822.dist-info/METADATA,sha256=P6pABVdw9AOupOf3JY6pa6q1ng7eAR8p0bR72sbBSJQ,4811
|
|
1207
|
+
cirq_core-1.5.0.dev20250212202822.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
1208
|
+
cirq_core-1.5.0.dev20250212202822.dist-info/top_level.txt,sha256=Sz9iOxHU0IEMLSFGwiwOCaN2e9K-jFbBbtpPN1hB73g,5
|
|
1209
|
+
cirq_core-1.5.0.dev20250212202822.dist-info/RECORD,,
|
{cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/LICENSE
RENAMED
|
File without changes
|
{cirq_core-1.5.0.dev20250211223123.dist-info → cirq_core-1.5.0.dev20250212202822.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|