pyqrack-cuda 1.44.12__tar.gz → 1.44.13__tar.gz
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.
- {pyqrack_cuda-1.44.12/pyqrack_cuda.egg-info → pyqrack_cuda-1.44.13}/PKG-INFO +1 -1
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_ace_backend.py +48 -1
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/setup.py +1 -1
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/LICENSE +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/Makefile +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/README.md +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyproject.toml +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.44.12 → pyqrack_cuda-1.44.13}/setup.cfg +0 -0
@@ -39,7 +39,8 @@ class QrackAceBackend:
|
|
39
39
|
"""
|
40
40
|
|
41
41
|
def __init__(self, qubit_count=-1, alternating_codes=True, toClone=None):
|
42
|
-
self.sim = toClone.sim.clone() if toClone else QrackSimulator(3 * qubit_count
|
42
|
+
self.sim = toClone.sim.clone() if toClone else QrackSimulator(3 * qubit_count + 1)
|
43
|
+
self._ancilla = 3 * qubit_count
|
43
44
|
self._factor_width(qubit_count)
|
44
45
|
self.alternating_codes = alternating_codes
|
45
46
|
|
@@ -118,66 +119,109 @@ class QrackAceBackend:
|
|
118
119
|
self._cx_shadow(hq[1], hq[2])
|
119
120
|
self.sim.mcx([hq[0]], hq[1])
|
120
121
|
|
122
|
+
def _correct(self, lq):
|
123
|
+
hq = self._unpack(lq)
|
124
|
+
shots = 1024
|
125
|
+
samples = self.sim.measure_shots(hq, shots)
|
126
|
+
syndrome = [0, 0, 0]
|
127
|
+
for sample in samples:
|
128
|
+
match sample:
|
129
|
+
case 1:
|
130
|
+
syndrome[0] += 1
|
131
|
+
case 2:
|
132
|
+
syndrome[1] += 1
|
133
|
+
case 4:
|
134
|
+
syndrome[2] += 1
|
135
|
+
case 6:
|
136
|
+
syndrome[0] += 1
|
137
|
+
case 5:
|
138
|
+
syndrome[1] += 1
|
139
|
+
case 3:
|
140
|
+
syndrome[2] += 1
|
141
|
+
max_syndrome = max(syndrome)
|
142
|
+
if (2 * max_syndrome) > shots:
|
143
|
+
error_bit = syndrome.index(max_syndrome)
|
144
|
+
row = (hq[0] // 3) // self.row_length
|
145
|
+
even_row = not (row & 1)
|
146
|
+
single_bit = 2 if (not self.alternating_codes or even_row) else 0
|
147
|
+
if error_bit == single_bit:
|
148
|
+
self.sim.x(hq[error_bit])
|
149
|
+
else:
|
150
|
+
self.sim.mcx([hq[1]], self._ancilla)
|
151
|
+
self.sim.mcx([hq[2]], self._ancilla)
|
152
|
+
self.sim.force_m(self._ancilla, True)
|
153
|
+
self.sim.x(hq[error_bit])
|
154
|
+
|
121
155
|
|
122
156
|
def u(self, th, ph, lm, lq):
|
123
157
|
hq = self._unpack(lq)
|
124
158
|
self._decode(hq)
|
125
159
|
self.sim.u(hq[0], th, ph, lm)
|
126
160
|
self._encode(hq)
|
161
|
+
self._correct(lq)
|
127
162
|
|
128
163
|
def r(self, p, th, lq):
|
129
164
|
hq = self._unpack(lq)
|
130
165
|
self._decode(hq)
|
131
166
|
self.sim.r(p, th, hq[0])
|
132
167
|
self._encode(hq)
|
168
|
+
self._correct(lq)
|
133
169
|
|
134
170
|
def s(self, lq):
|
135
171
|
hq = self._unpack(lq)
|
136
172
|
self._decode(hq)
|
137
173
|
self.sim.s(hq[0])
|
138
174
|
self._encode(hq)
|
175
|
+
self._correct(lq)
|
139
176
|
|
140
177
|
def adjs(self, lq):
|
141
178
|
hq = self._unpack(lq)
|
142
179
|
self._decode(hq)
|
143
180
|
self.sim.adjs(hq[0])
|
144
181
|
self._encode(hq)
|
182
|
+
self._correct(lq)
|
145
183
|
|
146
184
|
def x(self, lq):
|
147
185
|
hq = self._unpack(lq)
|
148
186
|
self._decode(hq)
|
149
187
|
self.sim.x(hq[0])
|
150
188
|
self._encode(hq)
|
189
|
+
self._correct(lq)
|
151
190
|
|
152
191
|
def y(self, lq):
|
153
192
|
hq = self._unpack(lq)
|
154
193
|
self._decode(hq)
|
155
194
|
self.sim.y(hq[0])
|
156
195
|
self._encode(hq)
|
196
|
+
self._correct(lq)
|
157
197
|
|
158
198
|
def z(self, lq):
|
159
199
|
hq = self._unpack(lq)
|
160
200
|
self._decode(hq)
|
161
201
|
self.sim.z(hq[0])
|
162
202
|
self._encode(hq)
|
203
|
+
self._correct(lq)
|
163
204
|
|
164
205
|
def h(self, lq):
|
165
206
|
hq = self._unpack(lq)
|
166
207
|
self._decode(hq)
|
167
208
|
self.sim.h(hq[0])
|
168
209
|
self._encode(hq)
|
210
|
+
self._correct(lq)
|
169
211
|
|
170
212
|
def t(self, lq):
|
171
213
|
hq = self._unpack(lq)
|
172
214
|
self._decode(hq)
|
173
215
|
self.sim.t(hq[0])
|
174
216
|
self._encode(hq)
|
217
|
+
self._correct(lq)
|
175
218
|
|
176
219
|
def adjt(self, lq):
|
177
220
|
hq = self._unpack(lq)
|
178
221
|
self._decode(hq)
|
179
222
|
self.sim.adjt(hq[0])
|
180
223
|
self._encode(hq)
|
224
|
+
self._correct(lq)
|
181
225
|
|
182
226
|
def _cpauli(self, lq1, lq2, anti, pauli):
|
183
227
|
gate = None
|
@@ -227,6 +271,9 @@ class QrackAceBackend:
|
|
227
271
|
gate([hq1[1]], hq2[1])
|
228
272
|
gate([hq1[2]], hq2[2])
|
229
273
|
|
274
|
+
self._correct(lq1)
|
275
|
+
self._correct(lq2)
|
276
|
+
|
230
277
|
|
231
278
|
def cx(self, lq1, lq2):
|
232
279
|
self._cpauli(lq1, lq2, False, Pauli.PauliX)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|