bloqade-circuit 0.6.0__py3-none-any.whl → 0.6.1__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.
- bloqade/qasm2/_qasm_loading.py +4 -1
- bloqade/qasm2/parse/lowering.py +11 -3
- bloqade/squin/lowering.py +29 -2
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.1.dist-info}/METADATA +1 -1
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.1.dist-info}/RECORD +7 -7
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.1.dist-info}/WHEEL +0 -0
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.1.dist-info}/licenses/LICENSE +0 -0
bloqade/qasm2/_qasm_loading.py
CHANGED
|
@@ -82,7 +82,7 @@ def loads(
|
|
|
82
82
|
body=body,
|
|
83
83
|
)
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
mt = ir.Method(
|
|
86
86
|
mod=None,
|
|
87
87
|
py_func=None,
|
|
88
88
|
sym_name=kernel_name,
|
|
@@ -91,6 +91,9 @@ def loads(
|
|
|
91
91
|
code=code,
|
|
92
92
|
)
|
|
93
93
|
|
|
94
|
+
mt.verify()
|
|
95
|
+
return mt
|
|
96
|
+
|
|
94
97
|
|
|
95
98
|
def loadfile(
|
|
96
99
|
qasm_file: str | pathlib.Path,
|
bloqade/qasm2/parse/lowering.py
CHANGED
|
@@ -202,7 +202,13 @@ class QASM2(lowering.LoweringABC[ast.Node]):
|
|
|
202
202
|
|
|
203
203
|
then_body = if_frame.curr_region
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
# NOTE: create empty else body
|
|
206
|
+
else_body = ir.Block(stmts=[scf.Yield()])
|
|
207
|
+
else_body.args.append_from(types.Bool)
|
|
208
|
+
|
|
209
|
+
state.current_frame.push(
|
|
210
|
+
scf.IfElse(cond, then_body=then_body, else_body=else_body)
|
|
211
|
+
)
|
|
206
212
|
|
|
207
213
|
def branch_next_if_not_terminated(self, frame: lowering.Frame):
|
|
208
214
|
"""Branch to the next block if the current block is not terminated.
|
|
@@ -381,6 +387,8 @@ class QASM2(lowering.LoweringABC[ast.Node]):
|
|
|
381
387
|
QubitType for _ in node.qparams
|
|
382
388
|
]
|
|
383
389
|
|
|
390
|
+
self_name = node.name + "_self"
|
|
391
|
+
|
|
384
392
|
with state.frame(
|
|
385
393
|
stmts=node.body,
|
|
386
394
|
finalize_next=False,
|
|
@@ -390,7 +398,7 @@ class QASM2(lowering.LoweringABC[ast.Node]):
|
|
|
390
398
|
types.Generic(
|
|
391
399
|
ir.Method, types.Tuple.where(tuple(arg_types)), types.NoneType
|
|
392
400
|
),
|
|
393
|
-
name=
|
|
401
|
+
name=self_name,
|
|
394
402
|
)
|
|
395
403
|
|
|
396
404
|
for arg_type, arg_name in zip(arg_types, arg_names):
|
|
@@ -422,7 +430,7 @@ class QASM2(lowering.LoweringABC[ast.Node]):
|
|
|
422
430
|
py_func=None,
|
|
423
431
|
sym_name=node.name,
|
|
424
432
|
dialects=self.dialects,
|
|
425
|
-
arg_names=[*node.cparams, *node.qparams],
|
|
433
|
+
arg_names=[self_name, *node.cparams, *node.qparams],
|
|
426
434
|
code=gate_func,
|
|
427
435
|
)
|
|
428
436
|
state.current_frame.globals[node.name] = mt
|
bloqade/squin/lowering.py
CHANGED
|
@@ -15,13 +15,40 @@ class ApplyAnyCallLowering(lowering.FromPythonCall["qubit.ApplyAny"]):
|
|
|
15
15
|
def lower(
|
|
16
16
|
self, stmt: type["qubit.ApplyAny"], state: lowering.State, node: ast.Call
|
|
17
17
|
):
|
|
18
|
-
if len(node.args) < 2:
|
|
18
|
+
if len(node.args) + len(node.keywords) < 2:
|
|
19
19
|
raise lowering.BuildError(
|
|
20
20
|
"Apply requires at least one operator and one qubit as arguments!"
|
|
21
21
|
)
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
op, qubits = self.unpack_arguments(node)
|
|
24
|
+
|
|
23
25
|
op_ssa = state.lower(op).expect_one()
|
|
24
26
|
qubits_lowered = [state.lower(qbit).expect_one() for qbit in qubits]
|
|
25
27
|
|
|
26
28
|
s = stmt(op_ssa, tuple(qubits_lowered))
|
|
27
29
|
return state.current_frame.push(s)
|
|
30
|
+
|
|
31
|
+
def unpack_arguments(self, node: ast.Call) -> tuple[ast.expr, list[ast.expr]]:
|
|
32
|
+
if len(node.keywords) == 0:
|
|
33
|
+
op, *qubits = node.args
|
|
34
|
+
return op, qubits
|
|
35
|
+
|
|
36
|
+
kwargs = {kw.arg: kw.value for kw in node.keywords}
|
|
37
|
+
if len(kwargs) > 2 or "qubits" not in kwargs:
|
|
38
|
+
raise lowering.BuildError(f"Got unsupported keyword argument {kwargs}")
|
|
39
|
+
|
|
40
|
+
qubits = kwargs["qubits"]
|
|
41
|
+
if len(kwargs) == 1:
|
|
42
|
+
if len(node.args) != 1:
|
|
43
|
+
raise lowering.BuildError("Missing operator argument")
|
|
44
|
+
op = node.args[0]
|
|
45
|
+
else:
|
|
46
|
+
try:
|
|
47
|
+
op = kwargs["operator"]
|
|
48
|
+
except KeyError:
|
|
49
|
+
raise lowering.BuildError(f"Got unsupported keyword argument {kwargs}")
|
|
50
|
+
|
|
51
|
+
if isinstance(qubits, ast.List):
|
|
52
|
+
return op, qubits.elts
|
|
53
|
+
|
|
54
|
+
return op, [qubits]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bloqade-circuit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.1
|
|
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
|
|
@@ -37,7 +37,7 @@ bloqade/pyqrack/squin/wire.py,sha256=rqlAeU-r_EHOwJMqHrEAxpZ_rKsvUpwGG7MP4BW75Nw
|
|
|
37
37
|
bloqade/pyqrack/squin/noise/__init__.py,sha256=uXgRQPOrHNRp3k2ff2HD8mheUEaqxZPKEnwV-s4BiV4,31
|
|
38
38
|
bloqade/pyqrack/squin/noise/native.py,sha256=KF4VGzU5Ps92DeLcIDIMsxQQtQ97z_3KUHqBPPkZFaM,2286
|
|
39
39
|
bloqade/qasm2/__init__.py,sha256=W9dR4Qnvigc7e7Ay7puSJHAIuiQk8vWqY-W64SMu5oU,515
|
|
40
|
-
bloqade/qasm2/_qasm_loading.py,sha256=
|
|
40
|
+
bloqade/qasm2/_qasm_loading.py,sha256=dSfjlB6Bm1ednfxc9L42dEa48s5q4N5SGQ9Iw21sBZQ,4753
|
|
41
41
|
bloqade/qasm2/_wrappers.py,sha256=4x3fldC4sV2K_XZ0FPZOorQKAbs_7pualListXtak4A,11148
|
|
42
42
|
bloqade/qasm2/glob.py,sha256=dDZW2KYXi9e0JmEbpVJIJvQytVEr86G7eism9ghlABM,579
|
|
43
43
|
bloqade/qasm2/groups.py,sha256=3-BGCVqJm6ZDgQeDapac65OLedoskJMVHX78YBKV7jY,2531
|
|
@@ -81,7 +81,7 @@ bloqade/qasm2/emit/impls/noise.py,sha256=-N9PmCbz8MwC6xtd55GOpjDoWMyJPJBMVDWT3G8
|
|
|
81
81
|
bloqade/qasm2/parse/__init__.py,sha256=01tlLfrR015nAAPWw3i_Cs9IXsShpXMnJMagcJ_Vuik,986
|
|
82
82
|
bloqade/qasm2/parse/ast.py,sha256=a48ssf0D_xaE-27PsyeBD5lBvwN2Dojj-RWIBhy7jJE,2904
|
|
83
83
|
bloqade/qasm2/parse/build.py,sha256=2CibD1ZRX3_aknmhb5XvFQcI2sBOn97DlQHomb9CMEw,10621
|
|
84
|
-
bloqade/qasm2/parse/lowering.py,sha256=
|
|
84
|
+
bloqade/qasm2/parse/lowering.py,sha256=bVAdctfa9LnWl0pQZZrHyTFwROpTXUfV7ktJPl6AzHg,21101
|
|
85
85
|
bloqade/qasm2/parse/parser.py,sha256=fxqp65dv8NnXE-Ie7ryLESfSH3Xr0unx1EBQysctiHM,121
|
|
86
86
|
bloqade/qasm2/parse/print.py,sha256=PaigQ5RbcfhOteWvDdQHoKsTE3tcNefpVfh1sp5eZEI,8973
|
|
87
87
|
bloqade/qasm2/parse/qasm2.lark,sha256=IYrBydUoVLn1VCNDPP5uNN5BHDET3fQ2yG11cOy900k,2238
|
|
@@ -123,7 +123,7 @@ bloqade/rewrite/rules/split_ifs.py,sha256=Nm4lpEUHZcnCeewIld0tt7UuGO69LiBGl7Uybu
|
|
|
123
123
|
bloqade/squin/__init__.py,sha256=MH7i5gR9DhTjLMI6vsP_NT7_yoaEowYiQwsYhrrUEX0,454
|
|
124
124
|
bloqade/squin/_typeinfer.py,sha256=bilWfC6whTMwewFCqDgB6vDHZsgXPr3azNOYqqnvtB4,780
|
|
125
125
|
bloqade/squin/groups.py,sha256=RXGJnNZUSXF_f5ljjhZ9At8UhaijayoxFoWvxEsUOWc,1310
|
|
126
|
-
bloqade/squin/lowering.py,sha256=
|
|
126
|
+
bloqade/squin/lowering.py,sha256=SR6q-IfV8WHPKT97M7UFu5KoRgAojfDno8Bft1mUSKM,1736
|
|
127
127
|
bloqade/squin/qubit.py,sha256=LgNJsm6qCyP7_O-lZg3YT8IiqzF5W5ff1VwQ79nXN4c,5148
|
|
128
128
|
bloqade/squin/types.py,sha256=T3lkqid4HEWuAK_wRns_p-K5DbLDwlldoyZtVay7A3o,119
|
|
129
129
|
bloqade/squin/wire.py,sha256=GZhF0EHCu7OU70zTV_N83yann-eQnYG_lM2u0QYFoAs,6596
|
|
@@ -223,7 +223,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
|
|
|
223
223
|
bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
|
|
224
224
|
bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
|
|
225
225
|
bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
|
|
226
|
-
bloqade_circuit-0.6.
|
|
227
|
-
bloqade_circuit-0.6.
|
|
228
|
-
bloqade_circuit-0.6.
|
|
229
|
-
bloqade_circuit-0.6.
|
|
226
|
+
bloqade_circuit-0.6.1.dist-info/METADATA,sha256=UulZPuoA-eaFH24p9sAdzlPQ2exC05Yvl7mdxTtuDJ0,3849
|
|
227
|
+
bloqade_circuit-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
228
|
+
bloqade_circuit-0.6.1.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
|
|
229
|
+
bloqade_circuit-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|