stimcirq 1.15.dev1741048818__tar.gz → 1.15.dev1741126803__tar.gz
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.
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/PKG-INFO +1 -1
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/setup.py +1 -1
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/__init__.py +1 -1
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cirq_to_stim.py +14 -10
- stimcirq-1.15.dev1741126803/stimcirq/_ii_gate.py +40 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_stim_to_cirq.py +31 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/PKG-INFO +1 -1
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/SOURCES.txt +1 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/README.md +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/setup.cfg +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cirq_to_stim_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cx_swap_gate.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cx_swap_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cz_swap_gate.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_cz_swap_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_det_annotation.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_det_annotation_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_measure_and_or_reset_gate.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_measure_and_or_reset_gate_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_obs_annotation.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_obs_annotation_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_shift_coords_annotation.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_shift_coords_annotation_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_stim_sampler.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_stim_sampler_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_stim_to_cirq_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_sweep_pauli.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_sweep_pauli_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_two_qubit_asymmetric_depolarize.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_two_qubit_asymmetric_depolarize_test.py +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/dependency_links.txt +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/requires.txt +0 -0
- {stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/top_level.txt +0 -0
|
@@ -6,6 +6,8 @@ from typing import Callable, cast, Dict, Iterable, List, Optional, Sequence, Tup
|
|
|
6
6
|
import cirq
|
|
7
7
|
import stim
|
|
8
8
|
|
|
9
|
+
from ._ii_gate import IIGate
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
def _forward_single_str_tag(op: cirq.CircuitOperation) -> str:
|
|
11
13
|
tags = [tag for tag in op.tags if isinstance(tag, str)]
|
|
@@ -219,27 +221,27 @@ def gate_to_stim_append_func() -> Dict[cirq.Gate, Callable[[stim.Circuit, List[i
|
|
|
219
221
|
sqcg(x, y): use("SQRT_X_DAG"),
|
|
220
222
|
sqcg(x, ny): use("SQRT_X"),
|
|
221
223
|
sqcg(nx, y): use("H_YZ"),
|
|
222
|
-
sqcg(nx, ny): use("
|
|
224
|
+
sqcg(nx, ny): use("H_NYZ"),
|
|
223
225
|
sqcg(x, z): do_nothing,
|
|
224
226
|
sqcg(x, nz): use("X"),
|
|
225
227
|
sqcg(nx, z): use("Z"),
|
|
226
228
|
sqcg(nx, nz): use("Y"),
|
|
227
229
|
sqcg(y, x): use("C_XYZ"),
|
|
228
|
-
sqcg(y, nx): use("
|
|
229
|
-
sqcg(ny, x): use("
|
|
230
|
-
sqcg(ny, nx): use("
|
|
230
|
+
sqcg(y, nx): use("C_XYNZ"),
|
|
231
|
+
sqcg(ny, x): use("C_XNYZ"),
|
|
232
|
+
sqcg(ny, nx): use("C_NXYZ"),
|
|
231
233
|
sqcg(y, z): use("S"),
|
|
232
234
|
sqcg(y, nz): use("H_XY"),
|
|
233
235
|
sqcg(ny, z): use("S_DAG"),
|
|
234
|
-
sqcg(ny, nz): use("
|
|
236
|
+
sqcg(ny, nz): use("H_NXY"),
|
|
235
237
|
sqcg(z, x): use("H"),
|
|
236
238
|
sqcg(z, nx): use("SQRT_Y_DAG"),
|
|
237
239
|
sqcg(nz, x): use("SQRT_Y"),
|
|
238
|
-
sqcg(nz, nx): use("
|
|
240
|
+
sqcg(nz, nx): use("H_NXZ"),
|
|
239
241
|
sqcg(z, y): use("C_ZYX"),
|
|
240
|
-
sqcg(z, ny): use("
|
|
241
|
-
sqcg(nz, y): use("
|
|
242
|
-
sqcg(nz, ny): use("
|
|
242
|
+
sqcg(z, ny): use("C_ZNYX"),
|
|
243
|
+
sqcg(nz, y): use("C_ZYNX"),
|
|
244
|
+
sqcg(nz, ny): use("C_NZYX"),
|
|
243
245
|
# All 36 cirq.PauliInteractionGate instances.
|
|
244
246
|
**{
|
|
245
247
|
cirq.PauliInteractionGate(p0, s0, p1, s1): use(
|
|
@@ -410,8 +412,10 @@ def _stim_append_controlled_gate(c: stim.Circuit, g: cirq.ControlledGate, t: Lis
|
|
|
410
412
|
|
|
411
413
|
|
|
412
414
|
def _stim_append_random_gate_channel(c: stim.Circuit, g: cirq.RandomGateChannel, t: List[int], tag: str):
|
|
413
|
-
if g.sub_gate in [cirq.X, cirq.Y, cirq.Z]:
|
|
415
|
+
if g.sub_gate in [cirq.X, cirq.Y, cirq.Z, cirq.I]:
|
|
414
416
|
c.append(f"{g.sub_gate}_ERROR", t, g.probability, tag=tag)
|
|
417
|
+
elif isinstance(g.sub_gate, IIGate):
|
|
418
|
+
c.append(f"II_ERROR", t, g.probability, tag=tag)
|
|
415
419
|
elif isinstance(g.sub_gate, cirq.DensePauliString):
|
|
416
420
|
target_p = [None, stim.target_x, stim.target_y, stim.target_z]
|
|
417
421
|
pauli_targets = [target_p[p](t) for t, p in zip(t, g.sub_gate.pauli_mask) if p]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Any, Dict, List
|
|
2
|
+
|
|
3
|
+
import cirq
|
|
4
|
+
import stim
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@cirq.value_equality
|
|
8
|
+
class IIGate(cirq.Gate):
|
|
9
|
+
"""Handles explaining stim's II gate to cirq."""
|
|
10
|
+
|
|
11
|
+
def _num_qubits_(self) -> int:
|
|
12
|
+
return 2
|
|
13
|
+
|
|
14
|
+
def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) -> List[str]:
|
|
15
|
+
return ['II', 'II']
|
|
16
|
+
|
|
17
|
+
def _value_equality_values_(self):
|
|
18
|
+
return ()
|
|
19
|
+
|
|
20
|
+
def _decompose_(self, qubits):
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def _stim_conversion_(self, edit_circuit: stim.Circuit, targets: List[int], tag: str, **kwargs):
|
|
24
|
+
edit_circuit.append('II', targets, tag=tag)
|
|
25
|
+
|
|
26
|
+
def __pow__(self, power: int) -> 'IIGate':
|
|
27
|
+
return self
|
|
28
|
+
|
|
29
|
+
def __str__(self) -> str:
|
|
30
|
+
return 'II'
|
|
31
|
+
|
|
32
|
+
def __repr__(self):
|
|
33
|
+
return f'stimcirq.IIGate()'
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def _json_namespace_() -> str:
|
|
37
|
+
return ''
|
|
38
|
+
|
|
39
|
+
def _json_dict_(self) -> Dict[str, Any]:
|
|
40
|
+
return {}
|
|
@@ -18,6 +18,7 @@ import stim
|
|
|
18
18
|
from ._cx_swap_gate import CXSwapGate
|
|
19
19
|
from ._cz_swap_gate import CZSwapGate
|
|
20
20
|
from ._det_annotation import DetAnnotation
|
|
21
|
+
from ._ii_gate import IIGate
|
|
21
22
|
from ._measure_and_or_reset_gate import MeasureAndOrResetGate
|
|
22
23
|
from ._obs_annotation import CumulativeObservableAnnotation
|
|
23
24
|
from ._shift_coords_annotation import ShiftCoordsAnnotation
|
|
@@ -499,6 +500,7 @@ class CircuitTranslationTracker:
|
|
|
499
500
|
),
|
|
500
501
|
"RZ": gate(cirq.ResetChannel()),
|
|
501
502
|
"I": gate(cirq.I),
|
|
503
|
+
"II": gate(IIGate()),
|
|
502
504
|
"X": gate(cirq.X),
|
|
503
505
|
"Y": gate(cirq.Y),
|
|
504
506
|
"Z": gate(cirq.Z),
|
|
@@ -507,9 +509,18 @@ class CircuitTranslationTracker:
|
|
|
507
509
|
),
|
|
508
510
|
"H": gate(cirq.H),
|
|
509
511
|
"H_XZ": gate(cirq.H),
|
|
512
|
+
"H_NXZ": gate(
|
|
513
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Z, True), z_to=(cirq.X, True))
|
|
514
|
+
),
|
|
510
515
|
"H_YZ": gate(
|
|
511
516
|
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.X, True), z_to=(cirq.Y, False))
|
|
512
517
|
),
|
|
518
|
+
"H_NXY": gate(
|
|
519
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Y, True), z_to=(cirq.Z, True))
|
|
520
|
+
),
|
|
521
|
+
"H_NYZ": gate(
|
|
522
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.X, True), z_to=(cirq.Y, True))
|
|
523
|
+
),
|
|
513
524
|
"SQRT_X": gate(cirq.X ** 0.5),
|
|
514
525
|
"SQRT_X_DAG": gate(cirq.X ** -0.5),
|
|
515
526
|
"SQRT_Y": gate(cirq.Y ** 0.5),
|
|
@@ -517,9 +528,27 @@ class CircuitTranslationTracker:
|
|
|
517
528
|
"C_XYZ": gate(
|
|
518
529
|
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Y, False), z_to=(cirq.X, False))
|
|
519
530
|
),
|
|
531
|
+
"C_NXYZ": gate(
|
|
532
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Y, True), z_to=(cirq.X, True))
|
|
533
|
+
),
|
|
534
|
+
"C_XNYZ": gate(
|
|
535
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Y, True), z_to=(cirq.X, False))
|
|
536
|
+
),
|
|
537
|
+
"C_XYNZ": gate(
|
|
538
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Y, False), z_to=(cirq.X, True))
|
|
539
|
+
),
|
|
520
540
|
"C_ZYX": gate(
|
|
521
541
|
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Z, False), z_to=(cirq.Y, False))
|
|
522
542
|
),
|
|
543
|
+
"C_NZYX": gate(
|
|
544
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Z, True), z_to=(cirq.Y, True))
|
|
545
|
+
),
|
|
546
|
+
"C_ZNYX": gate(
|
|
547
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Z, False), z_to=(cirq.Y, True))
|
|
548
|
+
),
|
|
549
|
+
"C_ZYNX": gate(
|
|
550
|
+
cirq.SingleQubitCliffordGate.from_xz_map(x_to=(cirq.Z, True), z_to=(cirq.Y, False))
|
|
551
|
+
),
|
|
523
552
|
"SQRT_XX": gate(cirq.XX ** 0.5),
|
|
524
553
|
"SQRT_YY": gate(cirq.YY ** 0.5),
|
|
525
554
|
"SQRT_ZZ": gate(cirq.ZZ ** 0.5),
|
|
@@ -551,6 +580,8 @@ class CircuitTranslationTracker:
|
|
|
551
580
|
"X_ERROR": noise(cirq.X.with_probability),
|
|
552
581
|
"Y_ERROR": noise(cirq.Y.with_probability),
|
|
553
582
|
"Z_ERROR": noise(cirq.Z.with_probability),
|
|
583
|
+
"I_ERROR": noise(cirq.I.with_probability),
|
|
584
|
+
"II_ERROR": noise(IIGate().with_probability),
|
|
554
585
|
"PAULI_CHANNEL_1": CircuitTranslationTracker.process_pauli_channel_1,
|
|
555
586
|
"PAULI_CHANNEL_2": CircuitTranslationTracker.process_pauli_channel_2,
|
|
556
587
|
"ELSE_CORRELATED_ERROR": not_impl(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_det_annotation_test.py
RENAMED
|
File without changes
|
{stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_measure_and_or_reset_gate.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_obs_annotation_test.py
RENAMED
|
File without changes
|
{stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq/_shift_coords_annotation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stimcirq-1.15.dev1741048818 → stimcirq-1.15.dev1741126803}/stimcirq.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|