bloqade-circuit 0.7.1__py3-none-any.whl → 0.7.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.

Potentially problematic release.


This version of bloqade-circuit might be problematic. Click here for more details.

bloqade/squin/__init__.py CHANGED
@@ -11,7 +11,8 @@ from .groups import wired as wired, kernel as kernel
11
11
 
12
12
  # NOTE: it's important to keep these imports here since they import squin.kernel
13
13
  # we skip isort here
14
- from . import gate as gate, parallel as parallel # isort: skip
14
+ from . import parallel as parallel # isort: skip
15
+ from .stdlib import gate as gate, channel as channel # isort: skip
15
16
 
16
17
  try:
17
18
  # NOTE: make sure optional cirq dependency is installed
@@ -22,13 +22,13 @@ def depolarize2(p: float) -> Op: ...
22
22
 
23
23
  @wraps(stmts.SingleQubitPauliChannel)
24
24
  def single_qubit_pauli_channel(
25
- params: ilist.IList[float, Literal[3]] | list[float] | tuple[float, float, float],
25
+ params: ilist.IList[float, Literal[3]] | list[float],
26
26
  ) -> Op: ...
27
27
 
28
28
 
29
29
  @wraps(stmts.TwoQubitPauliChannel)
30
30
  def two_qubit_pauli_channel(
31
- params: ilist.IList[float, Literal[15]] | list[float] | tuple[float, ...],
31
+ params: ilist.IList[float, Literal[15]] | list[float],
32
32
  ) -> Op: ...
33
33
 
34
34
 
@@ -30,7 +30,11 @@ class Depolarize(NoiseChannel):
30
30
  @statement(dialect=dialect)
31
31
  class Depolarize2(NoiseChannel):
32
32
  """
33
- Apply correlated depolarize error to two qubit
33
+ Apply correlated depolarize error to two qubits
34
+
35
+ This will apply one of the randomly chosen Pauli products:
36
+
37
+ {IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}
34
38
  """
35
39
 
36
40
  p: ir.SSAValue = info.argument(types.Float)
@@ -43,6 +47,16 @@ class SingleQubitPauliChannel(NoiseChannel):
43
47
 
44
48
  @statement(dialect=dialect)
45
49
  class TwoQubitPauliChannel(NoiseChannel):
50
+ """
51
+ This will apply one of the randomly chosen Pauli products:
52
+
53
+ {IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}
54
+
55
+ but the choice is weighed with the given probability.
56
+
57
+ NOTE: the given parameters are ordered as given in the list above!
58
+ """
59
+
46
60
  params: ir.SSAValue = info.argument(ilist.IListType[types.Float, types.Literal(15)])
47
61
 
48
62
 
File without changes
@@ -0,0 +1,86 @@
1
+ from bloqade.types import Qubit
2
+ from bloqade.squin.op.types import PauliOp
3
+
4
+ from .. import noise, qubit as _qubit, kernel
5
+
6
+
7
+ @kernel
8
+ def pauli_error(basis: PauliOp, p: float, qubit: Qubit) -> None:
9
+ """Apply the pauli operator given as basis with a probability p to qubit.
10
+
11
+ NOTE: the `PauliError` actually supports multiple qubits and multi-site bases,
12
+ it's only the short-hand definition here that is limited to a single qubit.
13
+ If you want to define a pauli error for multiple qubits, you can do so using
14
+ the statement, for example
15
+
16
+ ```python
17
+ q = squin.qubit.new(3)
18
+ multi_qubit_pauli = squin.op.pauli_string(string="XYZ")
19
+ pauli_error = squin.noise.pauli_error(basis=multi_qubit_pauli, p=0.1)
20
+ squin.qubit.apply(pauli_error, q[0], q[1], q[2])
21
+ ```
22
+
23
+ """
24
+ op = noise.pauli_error(basis, p)
25
+ _qubit.apply(op, qubit)
26
+
27
+
28
+ @kernel
29
+ def depolarize(p: float, qubit: Qubit) -> None:
30
+ """Apply depolarization error with probability p to qubit.
31
+
32
+ This means, that with a probability p/3 one of the three Pauli operators is applied.
33
+ Which Pauli operator is applied is chosen at random with equal probability.
34
+ """
35
+ op = noise.depolarize(p)
36
+ _qubit.apply(op, qubit)
37
+
38
+
39
+ @kernel
40
+ def depolarize2(p: float, qubit1: Qubit, qubit2: Qubit) -> None:
41
+ """Apply the correlated two-qubit depolarization error with probability p to qubits.
42
+
43
+ This means, that with a probability of p/15 one of the Pauli products {XX, XY, XZ, XI, YX, YY, ...}
44
+ is applied to the qubit pair. Which Pauli product is applied is chosen at random with equal probability.
45
+ """
46
+
47
+ op = noise.depolarize2(p)
48
+ _qubit.apply(op, qubit1, qubit2)
49
+
50
+
51
+ @kernel
52
+ def single_qubit_pauli_channel(params: list[float], qubit: Qubit) -> None:
53
+ """Apply the single qubit Pauli error with probabilities px, py, pz, respectively, to the qubit.
54
+
55
+ Similar to `depolarize`, but with distinct probabilities. An error occurs with the probability `px + py + pz`.
56
+ Which operator is applied is chosen at random, but weighed with the respective probabilities.
57
+ """
58
+ op = noise.single_qubit_pauli_channel(params)
59
+ _qubit.apply(op, qubit)
60
+
61
+
62
+ @kernel
63
+ def two_qubit_pauli_channel(params: list[float], qubit1: Qubit, qubit2: Qubit) -> None:
64
+ """Apply the two-qubit correlated Pauli error with probabilities given in the list above.
65
+
66
+ This means one of the operator products
67
+
68
+ {IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}
69
+
70
+ is applied. The choice of which is weighed by the given probabilities.
71
+
72
+ NOTE: the given parameters are ordered as given in the list above!
73
+
74
+ """
75
+ op = noise.two_qubit_pauli_channel(params)
76
+ _qubit.apply(op, qubit1, qubit2)
77
+
78
+
79
+ @kernel
80
+ def qubit_loss(p: float, qubit: Qubit) -> None:
81
+ """Apply a qubit loss channel with probability p.
82
+
83
+ When a loss channel is applied, the qubit is marked as lost by setting its state accordingly.
84
+ """
85
+ op = noise.qubit_loss(p)
86
+ _qubit.apply(op, qubit)
@@ -1,7 +1,8 @@
1
1
  from bloqade.types import Qubit
2
2
 
3
- from . import op as _op, qubit as _qubit
4
- from .groups import kernel
3
+ from ..groups import kernel
4
+
5
+ from .. import op as _op, qubit as _qubit # isort: skip
5
6
 
6
7
 
7
8
  @kernel
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bloqade-circuit
3
- Version: 0.7.1
3
+ Version: 0.7.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
@@ -125,9 +125,8 @@ bloqade/rewrite/rules/__init__.py,sha256=3e1Z5T3INqNtP6OU0Vivu_SdMOR_2KDixeA0Yjo
125
125
  bloqade/rewrite/rules/flatten_ilist.py,sha256=QoIxMaBXSlatpWzi5s_MAPnV3bV3GeoWc31RBw0WQ3s,1465
126
126
  bloqade/rewrite/rules/inline_getitem_ilist.py,sha256=uIXQRCsr3_GPMciDT4ghI-ezhQmkDcGcC6pguABPUVw,875
127
127
  bloqade/rewrite/rules/split_ifs.py,sha256=KhwvUx-oBrBO2F1j-J5kwNbdnrnEZcZtJflzyQm-UOI,2613
128
- bloqade/squin/__init__.py,sha256=b7ZD69ql9GriIPxN6JhWxANJVzuIJh_r-gC24wsW1mM,621
128
+ bloqade/squin/__init__.py,sha256=j9jgH39eQHedbVR9poKx2YHxOihclAI0GpIA05NejHM,675
129
129
  bloqade/squin/_typeinfer.py,sha256=bilWfC6whTMwewFCqDgB6vDHZsgXPr3azNOYqqnvtB4,780
130
- bloqade/squin/gate.py,sha256=NEmdr6ZTdaVDc4onB0ref-r-4T9fxyYosiX0DVuQJOo,4162
131
130
  bloqade/squin/groups.py,sha256=RXGJnNZUSXF_f5ljjhZ9At8UhaijayoxFoWvxEsUOWc,1310
132
131
  bloqade/squin/lowering.py,sha256=bfrPjx6t2mnd1qoBshF_RW-FXMWg3TOUA6XKUeONyig,2560
133
132
  bloqade/squin/parallel.py,sha256=X6Ps9kQIgnFMlZO14y2ntdxvivqbIP28PAWF8KmxByM,5172
@@ -150,9 +149,9 @@ bloqade/squin/cirq/emit/qubit.py,sha256=FManFeDyi1l4Sd07IeD7Lb4xR-7jy5Nwe-quQHI1
150
149
  bloqade/squin/cirq/emit/runtime.py,sha256=dH7JSMt2mALPhVFjmZETQzvnTUQ3BFY5poe0YZpM5vQ,6819
151
150
  bloqade/squin/noise/__init__.py,sha256=JFJ4kmEeWt6bJ2xx3yA5ek-NEbj8ilYWf6mepgbJLOo,338
152
151
  bloqade/squin/noise/_dialect.py,sha256=2IR98J-lXm5Y3srP9g-FD4JC-qTq2seureM6mKKq1xg,63
153
- bloqade/squin/noise/_wrapper.py,sha256=yGiL_x5INGA_86A04Ra6aF-i1eYTk2JhvpJWIPSdUZ4,783
152
+ bloqade/squin/noise/_wrapper.py,sha256=TrXZdtUIJ_wW392ka5_2Q-yYzCG1ApOzgSo5Sk7wmX8,734
154
153
  bloqade/squin/noise/rewrite.py,sha256=_6kGvxmbiMtL7MDHhLzgQnkq4SRthYA-cSKh_MBbC_U,4656
155
- bloqade/squin/noise/stmts.py,sha256=-_BX18aJTALYehDMczehYd_cNwsixzuZbOXh5ZG8lFw,1686
154
+ bloqade/squin/noise/stmts.py,sha256=fqhGPkVL5gZ_pMQaaOs_Pn81cp3WJjVOxHakT8ASxto,2094
156
155
  bloqade/squin/op/__init__.py,sha256=6JOjPdzc6RKO4299ZFz4Jk-wtVyPlGTkakYewHBueXw,841
157
156
  bloqade/squin/op/_dialect.py,sha256=66G1IYqmsqUEaCTyUqn2shSHmGYduiTU8GfDXcoMvw4,55
158
157
  bloqade/squin/op/_wrapper.py,sha256=XrEImj0M78u6imXq7SkckmWemziL7cM98FtoMj03l2M,1955
@@ -168,6 +167,9 @@ bloqade/squin/rewrite/canonicalize.py,sha256=hcfsn4ntsvnJ_cVnoUgcE5Zk9EqvwgixGAr
168
167
  bloqade/squin/rewrite/desugar.py,sha256=nl7yvUKgruIU0Ksb184a6r6ebeQ93HsEAG6hrPOmpWk,3296
169
168
  bloqade/squin/rewrite/remove_dangling_qubits.py,sha256=iTuWV-03YW5wtYbSeKMlnnWjNzDj9SmflyqYPgoYGy8,469
170
169
  bloqade/squin/rewrite/wrap_analysis.py,sha256=JUPS4OAYbDHOK0VIrdz1pprSizISUfN7osuoP_P-bIo,2256
170
+ bloqade/squin/stdlib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
171
+ bloqade/squin/stdlib/channel.py,sha256=ZZrnZlJ1UnjiGMaN2C3MFqbeCH94lb92gfmlb72pB-U,2978
172
+ bloqade/squin/stdlib/gate.py,sha256=5bwImrUOOH4Yl7VBVXsQmCtJMqtXdp6u6spMLiMWE5Q,4180
171
173
  bloqade/stim/__init__.py,sha256=QPZnQRWiiC66pwZ4yRiX2m5doqgPQorQLqc3b7fav2A,935
172
174
  bloqade/stim/_wrappers.py,sha256=Bx_cv-B5ifuFK9sJkURAFg3AzfDzS3oMObEEheX-Ieg,4045
173
175
  bloqade/stim/groups.py,sha256=Fx8G698BGO7hR8OwpPXGUEYdW4uCCPwbMp_3fJAqa8M,585
@@ -230,7 +232,7 @@ bloqade/visual/animation/runtime/atoms.py,sha256=EmjxhujLiHHPS_HtH_B-7TiqeHgvW5u
230
232
  bloqade/visual/animation/runtime/ppoly.py,sha256=JB9IP53N1w6adBJEue6J5Nmj818Id9JvrlgrmiQTU1I,1385
231
233
  bloqade/visual/animation/runtime/qpustate.py,sha256=rlmxQeJSvaohXrTpXQL5y-NJcpvfW33xPaYM1slv7cc,4270
232
234
  bloqade/visual/animation/runtime/utils.py,sha256=ju9IzOWX-vKwfpqUjlUKu3Ssr_UFPFFq-tzH_Nqyo_c,1212
233
- bloqade_circuit-0.7.1.dist-info/METADATA,sha256=z-DYZxBKke2_YBJPwEQKOwMqr9lWSJWG35Dio9e-afk,3850
234
- bloqade_circuit-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
235
- bloqade_circuit-0.7.1.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
236
- bloqade_circuit-0.7.1.dist-info/RECORD,,
235
+ bloqade_circuit-0.7.2.dist-info/METADATA,sha256=KbeXmKGSQGhwyFXcGNCRRWoy4sX4-tovOlIh4t8UMQk,3850
236
+ bloqade_circuit-0.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
237
+ bloqade_circuit-0.7.2.dist-info/licenses/LICENSE,sha256=S5GIJwR6QCixPA9wryYb44ZEek0Nz4rt_zLUqP05UbU,13160
238
+ bloqade_circuit-0.7.2.dist-info/RECORD,,