bloqade-circuit 0.6.0__py3-none-any.whl → 0.6.2__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.
- bloqade/cirq_utils/__init__.py +2 -0
- bloqade/cirq_utils/noise/__init__.py +11 -0
- bloqade/cirq_utils/noise/_two_zone_utils.py +531 -0
- bloqade/cirq_utils/noise/conflict_graph.py +166 -0
- bloqade/cirq_utils/noise/model.py +544 -0
- bloqade/cirq_utils/noise/transform.py +57 -0
- bloqade/cirq_utils/parallelize.py +4 -2
- bloqade/qasm2/_qasm_loading.py +4 -1
- bloqade/qasm2/parse/lowering.py +11 -3
- bloqade/squin/cirq/lowering.py +53 -5
- bloqade/squin/lowering.py +29 -2
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.2.dist-info}/METADATA +1 -1
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.2.dist-info}/RECORD +15 -10
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.2.dist-info}/WHEEL +0 -0
- {bloqade_circuit-0.6.0.dist-info → bloqade_circuit-0.6.2.dist-info}/licenses/LICENSE +0 -0
bloqade/squin/cirq/lowering.py
CHANGED
|
@@ -253,19 +253,29 @@ class Squin(lowering.LoweringABC[CirqNode]):
|
|
|
253
253
|
return state.current_frame.push(qubit.Apply(op_.result, qargs))
|
|
254
254
|
|
|
255
255
|
def visit_HPowGate(self, state: lowering.State[CirqNode], node: cirq.HPowGate):
|
|
256
|
-
if node.exponent == 1:
|
|
256
|
+
if abs(node.exponent) == 1:
|
|
257
257
|
return state.current_frame.push(op.stmts.H())
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
# NOTE: decompose into products of paulis for arbitrary exponents according to _decompose_ method
|
|
260
|
+
# can't use decompose directly since that method requires qubits to be passed in for some reason
|
|
261
|
+
y_rhs = state.lower(cirq.YPowGate(exponent=0.25)).expect_one()
|
|
262
|
+
x = state.lower(
|
|
263
|
+
cirq.XPowGate(exponent=node.exponent, global_shift=node.global_shift)
|
|
264
|
+
).expect_one()
|
|
265
|
+
y_lhs = state.lower(cirq.YPowGate(exponent=-0.25)).expect_one()
|
|
266
|
+
|
|
267
|
+
# NOTE: reversed order since we're creating a mult stmt
|
|
268
|
+
m_lhs = state.current_frame.push(op.stmts.Mult(y_lhs, x))
|
|
269
|
+
return state.current_frame.push(op.stmts.Mult(m_lhs.result, y_rhs))
|
|
260
270
|
|
|
261
271
|
def visit_XPowGate(self, state: lowering.State[CirqNode], node: cirq.XPowGate):
|
|
262
|
-
if node.exponent == 1:
|
|
272
|
+
if abs(node.exponent == 1):
|
|
263
273
|
return state.current_frame.push(op.stmts.X())
|
|
264
274
|
|
|
265
275
|
return self.visit(state, node.in_su2())
|
|
266
276
|
|
|
267
277
|
def visit_YPowGate(self, state: lowering.State[CirqNode], node: cirq.YPowGate):
|
|
268
|
-
if node.exponent == 1:
|
|
278
|
+
if abs(node.exponent == 1):
|
|
269
279
|
return state.current_frame.push(op.stmts.Y())
|
|
270
280
|
|
|
271
281
|
return self.visit(state, node.in_su2())
|
|
@@ -277,7 +287,7 @@ class Squin(lowering.LoweringABC[CirqNode]):
|
|
|
277
287
|
if node.exponent == 0.25:
|
|
278
288
|
return state.current_frame.push(op.stmts.T())
|
|
279
289
|
|
|
280
|
-
if node.exponent == 1:
|
|
290
|
+
if abs(node.exponent == 1):
|
|
281
291
|
return state.current_frame.push(op.stmts.Z())
|
|
282
292
|
|
|
283
293
|
# NOTE: just for the Z gate, an arbitrary exponent is equivalent to the ShiftOp
|
|
@@ -390,3 +400,41 @@ class Squin(lowering.LoweringABC[CirqNode]):
|
|
|
390
400
|
)
|
|
391
401
|
|
|
392
402
|
return noise_channel
|
|
403
|
+
|
|
404
|
+
def visit_DepolarizingChannel(
|
|
405
|
+
self, state: lowering.State[CirqNode], node: cirq.DepolarizingChannel
|
|
406
|
+
):
|
|
407
|
+
p = state.current_frame.push(py.Constant(node.p)).result
|
|
408
|
+
return state.current_frame.push(noise.stmts.Depolarize(p))
|
|
409
|
+
|
|
410
|
+
def visit_AsymmetricDepolarizingChannel(
|
|
411
|
+
self, state: lowering.State[CirqNode], node: cirq.AsymmetricDepolarizingChannel
|
|
412
|
+
):
|
|
413
|
+
nqubits = node.num_qubits()
|
|
414
|
+
if nqubits > 2:
|
|
415
|
+
raise lowering.BuildError(
|
|
416
|
+
"AsymmetricDepolarizingChannel applied to more than 2 qubits is not supported!"
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
if nqubits == 1:
|
|
420
|
+
p_x = state.current_frame.push(py.Constant(node.p_x)).result
|
|
421
|
+
p_y = state.current_frame.push(py.Constant(node.p_y)).result
|
|
422
|
+
p_z = state.current_frame.push(py.Constant(node.p_z)).result
|
|
423
|
+
params = state.current_frame.push(ilist.New(values=(p_x, p_y, p_z))).result
|
|
424
|
+
return state.current_frame.push(noise.stmts.SingleQubitPauliChannel(params))
|
|
425
|
+
|
|
426
|
+
# NOTE: nqubits == 2
|
|
427
|
+
error_probs = node.error_probabilities
|
|
428
|
+
paulis = ("I", "X", "Y", "Z")
|
|
429
|
+
values = []
|
|
430
|
+
for p1 in paulis:
|
|
431
|
+
for p2 in paulis:
|
|
432
|
+
if p1 == p2 == "I":
|
|
433
|
+
continue
|
|
434
|
+
|
|
435
|
+
p = error_probs.get(p1 + p2, 0.0)
|
|
436
|
+
p_ssa = state.current_frame.push(py.Constant(p)).result
|
|
437
|
+
values.append(p_ssa)
|
|
438
|
+
|
|
439
|
+
params = state.current_frame.push(ilist.New(values=values)).result
|
|
440
|
+
return state.current_frame.push(noise.stmts.TwoQubitPauliChannel(params))
|
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.2
|
|
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
|
|
@@ -13,9 +13,14 @@ bloqade/analysis/measure_id/__init__.py,sha256=J9I58iIyt4IjB36xK6_q9PV1B-40VJ1Gu
|
|
|
13
13
|
bloqade/analysis/measure_id/analysis.py,sha256=93S3a_Wu7Bt1j217l1hZMY2tLlR00aUYN27o0IhZsqU,1748
|
|
14
14
|
bloqade/analysis/measure_id/impls.py,sha256=ItS9bLMs8UdAkElYgrqD48Xlh9ZyoJq5xDPWcXjWH1c,4823
|
|
15
15
|
bloqade/analysis/measure_id/lattice.py,sha256=WPrn0R79umCH909BFWsUJ64qx9n_3KYimIW5UaXNuGU,1891
|
|
16
|
-
bloqade/cirq_utils/__init__.py,sha256=
|
|
16
|
+
bloqade/cirq_utils/__init__.py,sha256=1DRDCF3PpgJCOr0z7iULdrn3dqm7GLpRGs9AlqE7XA8,280
|
|
17
17
|
bloqade/cirq_utils/lineprog.py,sha256=JosrhfeOHI9FycUT_sYFj8TBzLpo97TL8zK-Ap2U4eQ,11021
|
|
18
|
-
bloqade/cirq_utils/parallelize.py,sha256=
|
|
18
|
+
bloqade/cirq_utils/parallelize.py,sha256=E2MsPm61Dkm3n0v4EFPJFGOc4B_Aw01yfhu-ViOKGiA,13812
|
|
19
|
+
bloqade/cirq_utils/noise/__init__.py,sha256=Z7d293ibzsNZyfS0tbL2JrdoypsDm20KE4zwlY6QnVA,559
|
|
20
|
+
bloqade/cirq_utils/noise/_two_zone_utils.py,sha256=3atgRbCMXZh0hu3zXAk7dThe4vljigKg0Z1bKPGM0s4,18293
|
|
21
|
+
bloqade/cirq_utils/noise/conflict_graph.py,sha256=ZUwPWTknrb6SgtZUVPeICn3YA-nUeWQJDuKKX5jL9tE,7179
|
|
22
|
+
bloqade/cirq_utils/noise/model.py,sha256=06Y_BLChOA-PhhAJcWLSgLVAAJoNjOrAujL1YCwcXA0,20590
|
|
23
|
+
bloqade/cirq_utils/noise/transform.py,sha256=tvDt4WMLM8dKPME51y0_peSZk2-jKmjq0urOxm0lWuQ,2309
|
|
19
24
|
bloqade/pyqrack/__init__.py,sha256=lonTS-luJkTVujCCtgdZRC12V7FQdoFcozAI-byXwN0,810
|
|
20
25
|
bloqade/pyqrack/base.py,sha256=9z61PaaAFqCBBwkgsDZSr-qr9IQ5OJ_JUvltmJ7Bgls,4407
|
|
21
26
|
bloqade/pyqrack/device.py,sha256=cOdyT1k0b73QbOsEIu5KqxHW2OAWP86fi_3XGPhaWGA,7134
|
|
@@ -37,7 +42,7 @@ bloqade/pyqrack/squin/wire.py,sha256=rqlAeU-r_EHOwJMqHrEAxpZ_rKsvUpwGG7MP4BW75Nw
|
|
|
37
42
|
bloqade/pyqrack/squin/noise/__init__.py,sha256=uXgRQPOrHNRp3k2ff2HD8mheUEaqxZPKEnwV-s4BiV4,31
|
|
38
43
|
bloqade/pyqrack/squin/noise/native.py,sha256=KF4VGzU5Ps92DeLcIDIMsxQQtQ97z_3KUHqBPPkZFaM,2286
|
|
39
44
|
bloqade/qasm2/__init__.py,sha256=W9dR4Qnvigc7e7Ay7puSJHAIuiQk8vWqY-W64SMu5oU,515
|
|
40
|
-
bloqade/qasm2/_qasm_loading.py,sha256=
|
|
45
|
+
bloqade/qasm2/_qasm_loading.py,sha256=dSfjlB6Bm1ednfxc9L42dEa48s5q4N5SGQ9Iw21sBZQ,4753
|
|
41
46
|
bloqade/qasm2/_wrappers.py,sha256=4x3fldC4sV2K_XZ0FPZOorQKAbs_7pualListXtak4A,11148
|
|
42
47
|
bloqade/qasm2/glob.py,sha256=dDZW2KYXi9e0JmEbpVJIJvQytVEr86G7eism9ghlABM,579
|
|
43
48
|
bloqade/qasm2/groups.py,sha256=3-BGCVqJm6ZDgQeDapac65OLedoskJMVHX78YBKV7jY,2531
|
|
@@ -81,7 +86,7 @@ bloqade/qasm2/emit/impls/noise.py,sha256=-N9PmCbz8MwC6xtd55GOpjDoWMyJPJBMVDWT3G8
|
|
|
81
86
|
bloqade/qasm2/parse/__init__.py,sha256=01tlLfrR015nAAPWw3i_Cs9IXsShpXMnJMagcJ_Vuik,986
|
|
82
87
|
bloqade/qasm2/parse/ast.py,sha256=a48ssf0D_xaE-27PsyeBD5lBvwN2Dojj-RWIBhy7jJE,2904
|
|
83
88
|
bloqade/qasm2/parse/build.py,sha256=2CibD1ZRX3_aknmhb5XvFQcI2sBOn97DlQHomb9CMEw,10621
|
|
84
|
-
bloqade/qasm2/parse/lowering.py,sha256=
|
|
89
|
+
bloqade/qasm2/parse/lowering.py,sha256=bVAdctfa9LnWl0pQZZrHyTFwROpTXUfV7ktJPl6AzHg,21101
|
|
85
90
|
bloqade/qasm2/parse/parser.py,sha256=fxqp65dv8NnXE-Ie7ryLESfSH3Xr0unx1EBQysctiHM,121
|
|
86
91
|
bloqade/qasm2/parse/print.py,sha256=PaigQ5RbcfhOteWvDdQHoKsTE3tcNefpVfh1sp5eZEI,8973
|
|
87
92
|
bloqade/qasm2/parse/qasm2.lark,sha256=IYrBydUoVLn1VCNDPP5uNN5BHDET3fQ2yG11cOy900k,2238
|
|
@@ -123,7 +128,7 @@ bloqade/rewrite/rules/split_ifs.py,sha256=Nm4lpEUHZcnCeewIld0tt7UuGO69LiBGl7Uybu
|
|
|
123
128
|
bloqade/squin/__init__.py,sha256=MH7i5gR9DhTjLMI6vsP_NT7_yoaEowYiQwsYhrrUEX0,454
|
|
124
129
|
bloqade/squin/_typeinfer.py,sha256=bilWfC6whTMwewFCqDgB6vDHZsgXPr3azNOYqqnvtB4,780
|
|
125
130
|
bloqade/squin/groups.py,sha256=RXGJnNZUSXF_f5ljjhZ9At8UhaijayoxFoWvxEsUOWc,1310
|
|
126
|
-
bloqade/squin/lowering.py,sha256=
|
|
131
|
+
bloqade/squin/lowering.py,sha256=SR6q-IfV8WHPKT97M7UFu5KoRgAojfDno8Bft1mUSKM,1736
|
|
127
132
|
bloqade/squin/qubit.py,sha256=LgNJsm6qCyP7_O-lZg3YT8IiqzF5W5ff1VwQ79nXN4c,5148
|
|
128
133
|
bloqade/squin/types.py,sha256=T3lkqid4HEWuAK_wRns_p-K5DbLDwlldoyZtVay7A3o,119
|
|
129
134
|
bloqade/squin/wire.py,sha256=GZhF0EHCu7OU70zTV_N83yann-eQnYG_lM2u0QYFoAs,6596
|
|
@@ -135,7 +140,7 @@ bloqade/squin/analysis/nsites/analysis.py,sha256=rIe1RU1MZRItcE2aB8DYahLrv73HfD3
|
|
|
135
140
|
bloqade/squin/analysis/nsites/impls.py,sha256=bVqO4E2hDzfYWwSG0pfj2j8oT1m0C3b42LdSHr4HQlo,2874
|
|
136
141
|
bloqade/squin/analysis/nsites/lattice.py,sha256=ruh0808SHtj3ecuT-C3AZTsLY2j3DRhtezGiTZvcuVs,942
|
|
137
142
|
bloqade/squin/cirq/__init__.py,sha256=fxvBvwX5VNfDmqkeM4GHguLQh53k-PJVsz89Eu0wRXw,8552
|
|
138
|
-
bloqade/squin/cirq/lowering.py,sha256=
|
|
143
|
+
bloqade/squin/cirq/lowering.py,sha256=F0_skv9lORxUFrhbNaN2ZQpqGnhPyslHt5E92uta5BQ,17959
|
|
139
144
|
bloqade/squin/cirq/emit/emit_circuit.py,sha256=7puJ3eCFwE9VdPb9NAiSdyRNkoQPwo_uVykz9Yv7c14,3761
|
|
140
145
|
bloqade/squin/cirq/emit/noise.py,sha256=rESjGC_66s2Y4FwwYda4rY3mYHYjbqLlKE_vnqpZDYI,1534
|
|
141
146
|
bloqade/squin/cirq/emit/op.py,sha256=z54NP5KqMxffXeFGWamEzvunpTNrxmYuluurk4j2-ps,4000
|
|
@@ -223,7 +228,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
|
|
|
223
228
|
bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
|
|
224
229
|
bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
|
|
225
230
|
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.
|
|
231
|
+
bloqade_circuit-0.6.2.dist-info/METADATA,sha256=jAkPyCEphiBvZ8PrjxLr8CBFybEdJl9wUY1TNVChGkc,3849
|
|
232
|
+
bloqade_circuit-0.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
233
|
+
bloqade_circuit-0.6.2.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
|
|
234
|
+
bloqade_circuit-0.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|