pyqrack-cuda 1.46.6__tar.gz → 1.46.7__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.46.6/pyqrack_cuda.egg-info → pyqrack_cuda-1.46.7}/PKG-INFO +1 -1
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_ace_backend.py +34 -34
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/setup.py +1 -1
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/LICENSE +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/Makefile +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/README.md +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyproject.toml +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.46.6 → pyqrack_cuda-1.46.7}/setup.cfg +0 -0
@@ -54,6 +54,10 @@ class QrackAceBackend:
|
|
54
54
|
if recursive_stack_depth < 1:
|
55
55
|
recursive_stack_depth = 1
|
56
56
|
self.recursive_stack_depth = recursive_stack_depth
|
57
|
+
self._ancilla = 3 * qubit_count
|
58
|
+
self._factor_width(qubit_count)
|
59
|
+
self.alternating_codes = alternating_codes
|
60
|
+
self._is_init = [False] * qubit_count
|
57
61
|
if recursive_stack_depth > 1:
|
58
62
|
recursive_stack_depth -= 1
|
59
63
|
self.sim = (
|
@@ -61,16 +65,15 @@ class QrackAceBackend:
|
|
61
65
|
if toClone
|
62
66
|
else QrackAceBackend(3 * qubit_count + 1, recursive_stack_depth=recursive_stack_depth, alternating_codes=alternating_codes, isTensorNetwork=isTensorNetwork, isStabilizerHybrid=isStabilizerHybrid, isBinaryDecisionTree=isBinaryDecisionTree)
|
63
67
|
)
|
68
|
+
# This leaves an "odd-man-out" ancillary qubit.
|
69
|
+
self.sim.row_length = 3 * self.row_length
|
70
|
+
self.sim.col_length = self.col_length
|
64
71
|
else:
|
65
72
|
self.sim = (
|
66
73
|
toClone.sim.clone()
|
67
74
|
if toClone
|
68
75
|
else QrackSimulator(3 * qubit_count + 1, isTensorNetwork=isTensorNetwork, isStabilizerHybrid=isStabilizerHybrid, isBinaryDecisionTree=isBinaryDecisionTree)
|
69
76
|
)
|
70
|
-
self._ancilla = 3 * qubit_count
|
71
|
-
self._factor_width(qubit_count)
|
72
|
-
self.alternating_codes = alternating_codes
|
73
|
-
self._is_init = [False] * qubit_count
|
74
77
|
|
75
78
|
def clone(self):
|
76
79
|
return QrackAceBackend(toClone=self)
|
@@ -135,19 +138,13 @@ class QrackAceBackend:
|
|
135
138
|
|
136
139
|
def _encode(self, hq, reverse=False):
|
137
140
|
lq = hq[0] // 3
|
138
|
-
|
139
|
-
|
141
|
+
even_row = not ((lq // self.row_length) & 1)
|
142
|
+
# Encode shadow-first
|
143
|
+
if self._is_init[lq]:
|
144
|
+
self._cx_shadow(hq[0], hq[2])
|
140
145
|
if ((not self.alternating_codes) and reverse) or (even_row == reverse):
|
141
|
-
|
142
|
-
# Encode shadow-first
|
143
|
-
self._cx_shadow(hq[0], hq[1])
|
144
|
-
self.sim.mcx([hq[1]], hq[2])
|
145
|
-
else:
|
146
|
-
self.sim.mcx([hq[2]], hq[1])
|
146
|
+
self.sim.mcx([hq[2]], hq[1])
|
147
147
|
else:
|
148
|
-
if self._is_init[lq]:
|
149
|
-
# Encode shadow-first
|
150
|
-
self._cx_shadow(hq[0], hq[2])
|
151
148
|
self.sim.mcx([hq[0]], hq[1])
|
152
149
|
self._is_init[lq] = True
|
153
150
|
|
@@ -155,16 +152,14 @@ class QrackAceBackend:
|
|
155
152
|
lq = hq[0] // 3
|
156
153
|
if not self._is_init[lq]:
|
157
154
|
return
|
158
|
-
|
159
|
-
even_row = not (row & 1)
|
155
|
+
even_row = not ((lq // self.row_length) & 1)
|
160
156
|
if ((not self.alternating_codes) and reverse) or (even_row == reverse):
|
161
157
|
# Decode entangled-first
|
162
|
-
self.sim.mcx([hq[
|
163
|
-
self._cx_shadow(hq[0], hq[1])
|
158
|
+
self.sim.mcx([hq[2]], hq[1])
|
164
159
|
else:
|
165
160
|
# Decode entangled-first
|
166
161
|
self.sim.mcx([hq[0]], hq[1])
|
167
|
-
|
162
|
+
self._cx_shadow(hq[0], hq[2])
|
168
163
|
|
169
164
|
def _correct(self, lq):
|
170
165
|
if not self._is_init[lq]:
|
@@ -172,20 +167,23 @@ class QrackAceBackend:
|
|
172
167
|
# We can't use true syndrome-based error correction,
|
173
168
|
# because one of the qubits in the code is separated.
|
174
169
|
# However, we can get pretty close!
|
175
|
-
shots =
|
176
|
-
|
170
|
+
shots = 512
|
171
|
+
|
177
172
|
single_bit = 0
|
178
173
|
other_bits = []
|
179
|
-
if not self.alternating_codes or
|
174
|
+
if not self.alternating_codes or not ((lq // self.row_length) & 1):
|
180
175
|
single_bit = 2
|
181
176
|
other_bits = [0, 1]
|
182
177
|
else:
|
183
178
|
single_bit = 0
|
184
179
|
other_bits = [1, 2]
|
180
|
+
|
185
181
|
hq = self._unpack(lq)
|
182
|
+
|
186
183
|
single_bit_value = self.sim.prob(hq[single_bit])
|
187
184
|
single_bit_polarization = max(single_bit_value, 1 - single_bit_value)
|
188
185
|
samples = self.sim.measure_shots([hq[other_bits[0]], hq[other_bits[1]]], shots)
|
186
|
+
|
189
187
|
syndrome_indices = (
|
190
188
|
[other_bits[1], other_bits[0]]
|
191
189
|
if (single_bit_value >= 0.5)
|
@@ -278,6 +276,7 @@ class QrackAceBackend:
|
|
278
276
|
lm += 2 * math.pi
|
279
277
|
hq = self._unpack(lq)
|
280
278
|
if not math.isclose(ph, -lm) and not math.isclose(abs(ph), math.pi / 2):
|
279
|
+
# Produces/destroys superposition
|
281
280
|
self._correct_if_like_h(th, lq)
|
282
281
|
self._decode(hq)
|
283
282
|
self.sim.u(hq[0], th, ph, lm)
|
@@ -285,6 +284,7 @@ class QrackAceBackend:
|
|
285
284
|
self.sim.u(hq[2], th, ph, lm)
|
286
285
|
self._encode(hq)
|
287
286
|
else:
|
287
|
+
# Shouldn't produce/destroy superposition
|
288
288
|
for b in hq:
|
289
289
|
self.sim.u(b, th, ph, lm)
|
290
290
|
|
@@ -297,9 +297,11 @@ class QrackAceBackend:
|
|
297
297
|
self._correct_if_like_h(th, lq)
|
298
298
|
hq = self._unpack(lq)
|
299
299
|
if (p == Pauli.PauliZ) or math.isclose(abs(th), math.pi):
|
300
|
+
# Doesn't produce/destroy superposition
|
300
301
|
for b in hq:
|
301
302
|
self.sim.r(p, th, b)
|
302
303
|
else:
|
304
|
+
# Produces/destroys superposition
|
303
305
|
self._decode(hq)
|
304
306
|
self.sim.r(p, th, hq[0])
|
305
307
|
if not self._is_init[lq]:
|
@@ -374,14 +376,14 @@ class QrackAceBackend:
|
|
374
376
|
|
375
377
|
return
|
376
378
|
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
379
|
+
lq1_row = lq1 // self.row_length
|
380
|
+
lq1_col = lq1 % self.row_length
|
381
|
+
lq2_row = lq2 // self.row_length
|
382
|
+
lq2_col = lq2 % self.row_length
|
381
383
|
|
382
384
|
hq1 = None
|
383
385
|
hq2 = None
|
384
|
-
if (
|
386
|
+
if (lq2_row == lq1_row) and (((lq1_col + 1) % self.row_length) == lq2_col):
|
385
387
|
self._correct(lq2)
|
386
388
|
hq1 = self._unpack(lq1, True)
|
387
389
|
hq2 = self._unpack(lq2, False)
|
@@ -390,7 +392,7 @@ class QrackAceBackend:
|
|
390
392
|
gate([hq1[0]], hq2[0])
|
391
393
|
self._encode(hq2, False)
|
392
394
|
self._encode(hq1, True)
|
393
|
-
elif (
|
395
|
+
elif (lq1_row == lq2_row) and (((lq2_col + 1) % self.row_length) == lq1_col):
|
394
396
|
self._correct(lq2)
|
395
397
|
hq2 = self._unpack(lq2, True)
|
396
398
|
hq1 = self._unpack(lq1, False)
|
@@ -403,7 +405,7 @@ class QrackAceBackend:
|
|
403
405
|
hq1 = self._unpack(lq1)
|
404
406
|
hq2 = self._unpack(lq2)
|
405
407
|
gate([hq1[0]], hq2[0])
|
406
|
-
if self.alternating_codes and ((
|
408
|
+
if self.alternating_codes and ((lq2_row & 1) != (lq1_row & 1)):
|
407
409
|
shadow(hq1[1], hq2[1])
|
408
410
|
else:
|
409
411
|
gate([hq1[1]], hq2[1])
|
@@ -476,8 +478,7 @@ class QrackAceBackend:
|
|
476
478
|
|
477
479
|
def m(self, lq):
|
478
480
|
hq = self._unpack(lq)
|
479
|
-
|
480
|
-
if not self.alternating_codes or even_row:
|
481
|
+
if not self.alternating_codes or not ((lq // self.row_length) & 1):
|
481
482
|
single_bit = 2
|
482
483
|
other_bits = [0, 1]
|
483
484
|
else:
|
@@ -563,8 +564,7 @@ class QrackAceBackend:
|
|
563
564
|
def prob(self, lq):
|
564
565
|
self._correct(lq)
|
565
566
|
hq = self._unpack(lq)
|
566
|
-
|
567
|
-
if not self.alternating_codes or even_row:
|
567
|
+
if not self.alternating_codes or not ((lq // self.row_length) & 1):
|
568
568
|
other_bits = [0, 1]
|
569
569
|
else:
|
570
570
|
other_bits = [1, 2]
|
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
|