bloqade-circuit 0.7.11__py3-none-any.whl → 0.7.13__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.

@@ -1 +1,2 @@
1
+ from . import impls as impls
1
2
  from .stim_str import FuncEmit as FuncEmit, EmitStimMain as EmitStimMain
@@ -0,0 +1,17 @@
1
+ from kirin.emit import EmitStrFrame
2
+ from kirin.interp import MethodTable, impl
3
+ from kirin.dialects.debug import Info, dialect
4
+
5
+ from bloqade.stim.emit.stim_str import EmitStimMain
6
+
7
+
8
+ @dialect.register(key="emit.stim")
9
+ class EmitStimDebugMethods(MethodTable):
10
+
11
+ @impl(Info)
12
+ def info(self, emit: EmitStimMain, frame: EmitStrFrame, stmt: Info):
13
+
14
+ msg: str = frame.get(stmt.msg)
15
+ emit.writeln(frame, f"# {msg}")
16
+
17
+ return ()
@@ -3,7 +3,6 @@ from kirin.rewrite.abc import RewriteRule, RewriteResult
3
3
 
4
4
  from bloqade.squin import op, noise, qubit
5
5
  from bloqade.squin.rewrite import AddressAttribute
6
- from bloqade.stim.dialects import gate
7
6
  from bloqade.stim.rewrite.util import (
8
7
  SQUIN_STIM_OP_MAPPING,
9
8
  rewrite_Control,
@@ -40,20 +39,24 @@ class SquinQubitToStim(RewriteRule):
40
39
 
41
40
  assert isinstance(applied_op, op.stmts.Operator)
42
41
 
42
+ # Handle controlled gates with a separate procedure
43
43
  if isinstance(applied_op, op.stmts.Control):
44
44
  return rewrite_Control(stmt)
45
45
 
46
- # need to handle Control through separate means
47
-
48
46
  # check if its adjoint, assume its canonicalized so no nested adjoints.
49
47
  is_conj = False
50
48
  if isinstance(applied_op, op.stmts.Adjoint):
51
- if not applied_op.is_unitary:
49
+ # By default the Adjoint has is_unitary = False, so we need to check
50
+ # the inner applied operator to make sure its not just unitary,
51
+ # but something that has an equivalent stim representation with *_DAG format.
52
+ if isinstance(
53
+ applied_op.op.owner, (op.stmts.SqrtX, op.stmts.SqrtY, op.stmts.S)
54
+ ):
55
+ is_conj = True
56
+ applied_op = applied_op.op.owner
57
+ else:
52
58
  return RewriteResult()
53
59
 
54
- is_conj = True
55
- applied_op = applied_op.op.owner
56
-
57
60
  stim_1q_op = SQUIN_STIM_OP_MAPPING.get(type(applied_op))
58
61
  if stim_1q_op is None:
59
62
  return RewriteResult()
@@ -71,13 +74,14 @@ class SquinQubitToStim(RewriteRule):
71
74
  if qubit_idx_ssas is None:
72
75
  return RewriteResult()
73
76
 
74
- if isinstance(stim_1q_op, gate.stmts.Gate):
77
+ # At this point, we know for certain stim_1q_op must be SQRT_X, SQRT_Y, or S
78
+ # and has the option to set the dagger attribute. If is_conj is false,
79
+ # the rewrite would have terminated early so we know anything else has to be
80
+ # a non 1Q gate operation.
81
+ if is_conj:
75
82
  stim_1q_stmt = stim_1q_op(targets=tuple(qubit_idx_ssas), dagger=is_conj)
76
83
  else:
77
84
  stim_1q_stmt = stim_1q_op(targets=tuple(qubit_idx_ssas))
78
85
  stmt.replace_by(stim_1q_stmt)
79
86
 
80
87
  return RewriteResult(has_done_something=True)
81
-
82
-
83
- # put rewrites for measure statements in separate rule, then just have to dispatch
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bloqade-circuit
3
- Version: 0.7.11
3
+ Version: 0.7.13
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
7
7
  Requires-Python: >=3.10
8
- Requires-Dist: kirin-toolchain~=0.17.23
8
+ Requires-Dist: kirin-toolchain~=0.17.26
9
9
  Requires-Dist: numpy>=1.22.0
10
10
  Requires-Dist: pandas>=2.2.3
11
11
  Requires-Dist: pydantic<2.11.0,>=1.3.0
@@ -213,7 +213,8 @@ bloqade/stim/dialects/noise/__init__.py,sha256=WoDdIZnxelk8REiIWDKcrEW79xwISdTZl
213
213
  bloqade/stim/dialects/noise/_dialect.py,sha256=SVUjAqBoGnxo13JlAlsxulIMo1QzfJb4SMSrFaCnfP4,57
214
214
  bloqade/stim/dialects/noise/emit.py,sha256=BCxaJPLTU_pKkFgw9rtOzTIqZKP4o4NgDM-x128NX9s,2936
215
215
  bloqade/stim/dialects/noise/stmts.py,sha256=WJOlhLMfazP6u7jMMpKeCpX-gIL8_D1jv33mxclHrz4,3661
216
- bloqade/stim/emit/__init__.py,sha256=N2dPQY7OyqPwHAStDeOgYg2yfxqxMOz-N7pD5Z4JwlI,73
216
+ bloqade/stim/emit/__init__.py,sha256=GZst8q95tnaCf789z-Ha2t6WMiOZ429X7h8mzX5rFM0,102
217
+ bloqade/stim/emit/impls.py,sha256=Isld_CikedHvrU6CahEkSRLwwLC87iK57CRk_ojob90,446
217
218
  bloqade/stim/emit/stim_str.py,sha256=JyEBoIhLQASogZcUWHI9tMD4JoXYrEqUr2qaZ30gZdc,1491
218
219
  bloqade/stim/parse/__init__.py,sha256=l2DjReB2KkgrDjP_4nP6RnoziiOewoSeZfTno1sVYTw,59
219
220
  bloqade/stim/parse/lowering.py,sha256=L-IcR_exlxsTVv4SQ0bhzIF4_L82P-GEdK6qRd6B86Y,23723
@@ -223,7 +224,7 @@ bloqade/stim/passes/squin_to_stim.py,sha256=mqCspofBJ60YUU5dl7AdxmctmHygk1yeRr4u
223
224
  bloqade/stim/rewrite/__init__.py,sha256=zL5G73JEsXkehN7gCtUgGnmC2BJ3vKihOd1ohVwM68E,480
224
225
  bloqade/stim/rewrite/ifs_to_stim.py,sha256=A3SndoGinZHLul17zXWyQrK_1Hy5I4qvuOskLIeDRMU,6942
225
226
  bloqade/stim/rewrite/py_constant_to_stim.py,sha256=PV8bHvn759-d_0JW4akaGSORW_oxigrlUBhAC51PJAU,1354
226
- bloqade/stim/rewrite/qubit_to_stim.py,sha256=vdTjzVJyzslp6BbXz5219DjF1pUJF9kvNWwUtQ_MP0g,2627
227
+ bloqade/stim/rewrite/qubit_to_stim.py,sha256=Kf_56IU6v7Fv_2x7Ce5Wv2wE8yfC-UDBG90aA_6nRIw,3112
227
228
  bloqade/stim/rewrite/squin_measure.py,sha256=1zuILosGACN7rPYA87MYVwv0M4pPTala1YTe9owbhkw,2519
228
229
  bloqade/stim/rewrite/squin_noise.py,sha256=P-54e3lH9L2irsknRQ7u9UkCmUOQZFDra_yHlLlClDk,6379
229
230
  bloqade/stim/rewrite/util.py,sha256=o96hA-h03vpwsB0jVe_q0hCmTVINaMaZKn1IYWM6DtM,7751
@@ -242,7 +243,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
242
243
  bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
243
244
  bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
244
245
  bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
245
- bloqade_circuit-0.7.11.dist-info/METADATA,sha256=JCGZ-nrxZmVVGNnXU-Duw1f1YbArfNPgeJyDOMYzLCI,3725
246
- bloqade_circuit-0.7.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
247
- bloqade_circuit-0.7.11.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
248
- bloqade_circuit-0.7.11.dist-info/RECORD,,
246
+ bloqade_circuit-0.7.13.dist-info/METADATA,sha256=iAJe2OcOsiezdNzRler8zZvQXrxfT3oh-14PAB5Pz-k,3725
247
+ bloqade_circuit-0.7.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
248
+ bloqade_circuit-0.7.13.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
249
+ bloqade_circuit-0.7.13.dist-info/RECORD,,