bloqade-circuit 0.6.6__py3-none-any.whl → 0.6.7__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 bloqade-circuit might be problematic. Click here for more details.

@@ -81,6 +81,13 @@ class SquinOp(interp.MethodTable):
81
81
  op_sites = frame.get(stmt.op)
82
82
  return (op_sites,)
83
83
 
84
+ @interp.impl(op.stmts.PauliString)
85
+ def pauli_string(
86
+ self, interp: NSitesAnalysis, frame: interp.Frame, stmt: op.stmts.PauliString
87
+ ):
88
+ s = stmt.string
89
+ return (NumberSites(sites=len(s)),)
90
+
84
91
 
85
92
  @scf.dialect.register(key="op.nsites")
86
93
  class ScfSquinOp(ScfTypeInfer):
@@ -3,7 +3,7 @@ import itertools
3
3
  from kirin import ir
4
4
  from kirin.passes import Pass
5
5
  from kirin.rewrite import Walk
6
- from kirin.dialects import ilist
6
+ from kirin.dialects import py, ilist
7
7
  from kirin.rewrite.abc import RewriteRule, RewriteResult
8
8
 
9
9
  from .stmts import (
@@ -11,6 +11,7 @@ from .stmts import (
11
11
  QubitLoss,
12
12
  Depolarize,
13
13
  PauliError,
14
+ Depolarize2,
14
15
  NoiseChannel,
15
16
  TwoQubitPauliChannel,
16
17
  SingleQubitPauliChannel,
@@ -58,6 +59,18 @@ class _RewriteNoiseStmts(RewriteRule):
58
59
  def rewrite_two_qubit_pauli_channel(
59
60
  self, node: TwoQubitPauliChannel
60
61
  ) -> RewriteResult:
62
+ operator_list = self._insert_two_qubit_paulis_before_node(node)
63
+ stochastic_unitary = StochasticUnitaryChannel(
64
+ operators=operator_list, probabilities=node.params
65
+ )
66
+
67
+ node.replace_by(stochastic_unitary)
68
+ return RewriteResult(has_done_something=True)
69
+
70
+ @staticmethod
71
+ def _insert_two_qubit_paulis_before_node(
72
+ node: TwoQubitPauliChannel | Depolarize2,
73
+ ) -> ir.ResultValue:
61
74
  paulis = (Identity(sites=1), X(), Y(), Z())
62
75
  for op in paulis:
63
76
  op.insert_before(node)
@@ -71,12 +84,7 @@ class _RewriteNoiseStmts(RewriteRule):
71
84
  operators.append(op.result)
72
85
 
73
86
  (operator_list := ilist.New(values=operators)).insert_before(node)
74
- stochastic_unitary = StochasticUnitaryChannel(
75
- operators=operator_list.result, probabilities=node.params
76
- )
77
-
78
- node.replace_by(stochastic_unitary)
79
- return RewriteResult(has_done_something=True)
87
+ return operator_list.result
80
88
 
81
89
  def rewrite_p_p_error(self, node: PPError) -> RewriteResult:
82
90
  (operators := ilist.New(values=(node.op,))).insert_before(node)
@@ -95,8 +103,14 @@ class _RewriteNoiseStmts(RewriteRule):
95
103
  op.insert_before(node)
96
104
  operators.append(op.result)
97
105
 
106
+ # NOTE: need to divide the probability by 3 to get the correct total error rate
107
+ (three := py.Constant(3)).insert_before(node)
108
+ (p_over_3 := py.Div(node.p, three.result)).insert_before(node)
109
+
98
110
  (operator_list := ilist.New(values=operators)).insert_before(node)
99
- (ps := ilist.New(values=[node.p for _ in range(3)])).insert_before(node)
111
+ (ps := ilist.New(values=[p_over_3.result for _ in range(3)])).insert_before(
112
+ node
113
+ )
100
114
 
101
115
  stochastic_unitary = StochasticUnitaryChannel(
102
116
  operators=operator_list.result, probabilities=ps.result
@@ -105,6 +119,21 @@ class _RewriteNoiseStmts(RewriteRule):
105
119
 
106
120
  return RewriteResult(has_done_something=True)
107
121
 
122
+ def rewrite_depolarize2(self, node: Depolarize2) -> RewriteResult:
123
+ operator_list = self._insert_two_qubit_paulis_before_node(node)
124
+
125
+ # NOTE: need to divide the probability by 15 to get the correct total error rate
126
+ (fifteen := py.Constant(15)).insert_before(node)
127
+ (p_over_15 := py.Div(node.p, fifteen.result)).insert_before(node)
128
+ (probs := ilist.New(values=[p_over_15.result] * 15)).insert_before(node)
129
+
130
+ stochastic_unitary = StochasticUnitaryChannel(
131
+ operators=operator_list, probabilities=probs.result
132
+ )
133
+ node.replace_by(stochastic_unitary)
134
+
135
+ return RewriteResult(has_done_something=True)
136
+
108
137
 
109
138
  class RewriteNoiseStmts(Pass):
110
139
  def unsafe_run(self, mt: ir.Method):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bloqade-circuit
3
- Version: 0.6.6
3
+ Version: 0.6.7
4
4
  Summary: The software development toolkit for neutral atom arrays.
5
5
  Author-email: Roger-luo <rluo@quera.com>, kaihsin <khwu@quera.com>, weinbe58 <pweinberg@quera.com>, johnzl-777 <jlong@quera.com>
6
6
  License-File: LICENSE
@@ -139,7 +139,7 @@ bloqade/squin/analysis/address_impl.py,sha256=eMEGlkw88ozj8ZGHcfQ0qW2K_dNxYxnhwz
139
139
  bloqade/squin/analysis/schedule.py,sha256=buuC4bFuLuaSDK2BZfkRkh8ZdNicz9HkEv3FAnsDViE,7880
140
140
  bloqade/squin/analysis/nsites/__init__.py,sha256=RlQg7ivczXCXG5lMeL3ipYKj2oJKC4THu8orYf5PBYs,263
141
141
  bloqade/squin/analysis/nsites/analysis.py,sha256=rIe1RU1MZRItcE2aB8DYahLrv73HfD3IHCX3E_EGQ1c,1773
142
- bloqade/squin/analysis/nsites/impls.py,sha256=bVqO4E2hDzfYWwSG0pfj2j8oT1m0C3b42LdSHr4HQlo,2874
142
+ bloqade/squin/analysis/nsites/impls.py,sha256=wSNWjNmgwCP35FgmreyLKmRYedxlebWi7LhsEq9jPs4,3097
143
143
  bloqade/squin/analysis/nsites/lattice.py,sha256=ruh0808SHtj3ecuT-C3AZTsLY2j3DRhtezGiTZvcuVs,942
144
144
  bloqade/squin/cirq/__init__.py,sha256=7OYYboSl5lPwdWOKk4AJgm1s1lBX_WAstVqPfaynSv8,10156
145
145
  bloqade/squin/cirq/lowering.py,sha256=F0_skv9lORxUFrhbNaN2ZQpqGnhPyslHt5E92uta5BQ,17959
@@ -151,7 +151,7 @@ bloqade/squin/cirq/emit/runtime.py,sha256=dH7JSMt2mALPhVFjmZETQzvnTUQ3BFY5poe0YZ
151
151
  bloqade/squin/noise/__init__.py,sha256=xST2qojx6ZApRoiKIXOtifDzSpTZgo-67ja309FFvWw,364
152
152
  bloqade/squin/noise/_dialect.py,sha256=2IR98J-lXm5Y3srP9g-FD4JC-qTq2seureM6mKKq1xg,63
153
153
  bloqade/squin/noise/_wrapper.py,sha256=P8fkr1_2U47PtvqnQqeTI7VzThNIK17cNh2QX6ABh_w,815
154
- bloqade/squin/noise/rewrite.py,sha256=-IqFfDGnhuaFI-9b6PXjhSuiXFM1C5Qu0ibL5GvZldI,3917
154
+ bloqade/squin/noise/rewrite.py,sha256=8v8AAi2G-ZatZ6dTpqc88hCBMMoWz2TK3nwkLkwk7Fo,5099
155
155
  bloqade/squin/noise/stmts.py,sha256=F8AsDp2xsLez9vkSamDW985MUCubz3TMRrE0L745GmI,1875
156
156
  bloqade/squin/op/__init__.py,sha256=6JOjPdzc6RKO4299ZFz4Jk-wtVyPlGTkakYewHBueXw,841
157
157
  bloqade/squin/op/_dialect.py,sha256=66G1IYqmsqUEaCTyUqn2shSHmGYduiTU8GfDXcoMvw4,55
@@ -230,7 +230,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
230
230
  bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
231
231
  bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
232
232
  bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
233
- bloqade_circuit-0.6.6.dist-info/METADATA,sha256=uDJH5m1IwfBujpFvXFYjP89i0aHRbwSMEc6vhx9xwXw,3849
234
- bloqade_circuit-0.6.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
235
- bloqade_circuit-0.6.6.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
236
- bloqade_circuit-0.6.6.dist-info/RECORD,,
233
+ bloqade_circuit-0.6.7.dist-info/METADATA,sha256=n1lFzCB0O9SdZuCP9tn57cphpaOC57lIqQ75sXMnTIU,3849
234
+ bloqade_circuit-0.6.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
235
+ bloqade_circuit-0.6.7.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
236
+ bloqade_circuit-0.6.7.dist-info/RECORD,,