pyqrack-cuda 1.54.4__tar.gz → 1.55.0__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.54.4/pyqrack_cuda.egg-info → pyqrack_cuda-1.55.0}/PKG-INFO +1 -1
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_ace_backend.py +30 -16
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/setup.py +1 -1
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/LICENSE +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/Makefile +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/README.md +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyproject.toml +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.54.4 → pyqrack_cuda-1.55.0}/setup.cfg +0 -0
@@ -30,9 +30,12 @@ except ImportError:
|
|
30
30
|
# Initial stub and concept produced through conversation with Elara
|
31
31
|
# (the custom OpenAI GPT)
|
32
32
|
class LHVQubit:
|
33
|
-
def __init__(self):
|
33
|
+
def __init__(self, toClone=None):
|
34
34
|
# Initial state in "Bloch vector" terms, defaults to |0⟩
|
35
|
-
|
35
|
+
if toClone:
|
36
|
+
self.bloch = toClone.bloch.copy()
|
37
|
+
else:
|
38
|
+
self.reset()
|
36
39
|
|
37
40
|
def reset(self):
|
38
41
|
self.bloch = [0.0, 0.0, 1.0]
|
@@ -46,6 +49,10 @@ class LHVQubit:
|
|
46
49
|
x, y, z = self.bloch
|
47
50
|
self.bloch = [x, y, -z]
|
48
51
|
|
52
|
+
def y(self):
|
53
|
+
x, y, z = self.bloch
|
54
|
+
self.bloch = [-x, y, z]
|
55
|
+
|
49
56
|
def z(self):
|
50
57
|
x, y, z = self.bloch
|
51
58
|
self.bloch = [x, -y, z]
|
@@ -159,23 +166,23 @@ class QrackAceBackend:
|
|
159
166
|
def __init__(
|
160
167
|
self,
|
161
168
|
qubit_count=1,
|
162
|
-
long_range_columns
|
169
|
+
long_range_columns=2,
|
163
170
|
is_transpose=False,
|
164
171
|
isTensorNetwork=False,
|
165
172
|
isStabilizerHybrid=False,
|
166
173
|
isBinaryDecisionTree=False,
|
167
174
|
toClone=None,
|
168
175
|
):
|
169
|
-
if qubit_count < 0:
|
170
|
-
qubit_count = 0
|
171
176
|
if toClone:
|
172
177
|
qubit_count = toClone.num_qubits()
|
173
178
|
long_range_columns = toClone.long_range_columns
|
174
179
|
is_transpose = toClone.is_transpose
|
180
|
+
if qubit_count < 0:
|
181
|
+
qubit_count = 0
|
182
|
+
if long_range_columns < 0:
|
183
|
+
long_range_columns = 0
|
175
184
|
|
176
185
|
self._factor_width(qubit_count, is_transpose)
|
177
|
-
if long_range_columns < 0:
|
178
|
-
long_range_columns = 3 if (self._row_length % 3) == 1 else 2
|
179
186
|
self.long_range_columns = long_range_columns
|
180
187
|
self.is_transpose = is_transpose
|
181
188
|
|
@@ -211,7 +218,7 @@ class QrackAceBackend:
|
|
211
218
|
tot_qubits += 1
|
212
219
|
sim_counts[sim_id] += 1
|
213
220
|
|
214
|
-
self._lhv_dict[tot_qubits] = LHVQubit()
|
221
|
+
self._lhv_dict[tot_qubits] = LHVQubit(toClone = toClone._lhv_dict[tot_qubits] if toClone else None)
|
215
222
|
tot_qubits += 1
|
216
223
|
|
217
224
|
sim_id = (sim_id + 1) % sim_count
|
@@ -235,7 +242,7 @@ class QrackAceBackend:
|
|
235
242
|
|
236
243
|
# You can still "monkey-patch" this, after the constructor.
|
237
244
|
if "QRACK_QUNIT_SEPARABILITY_THRESHOLD" not in os.environ:
|
238
|
-
self.sim[i].set_sdrp(0.
|
245
|
+
self.sim[i].set_sdrp(0.02375)
|
239
246
|
|
240
247
|
def clone(self):
|
241
248
|
return QrackAceBackend(toClone=self)
|
@@ -288,13 +295,13 @@ class QrackAceBackend:
|
|
288
295
|
|
289
296
|
def _qec_s(self, t):
|
290
297
|
if isinstance(t, tuple):
|
291
|
-
self.sim[
|
298
|
+
self.sim[t[0]].s(t[1])
|
292
299
|
else:
|
293
300
|
t.s()
|
294
301
|
|
295
302
|
def _qec_adjs(self, t):
|
296
303
|
if isinstance(t, tuple):
|
297
|
-
self.sim[
|
304
|
+
self.sim[t[0]].adjs(t[1])
|
298
305
|
else:
|
299
306
|
t.adjs()
|
300
307
|
|
@@ -350,8 +357,10 @@ class QrackAceBackend:
|
|
350
357
|
self.sim[b[0]].h(b[1])
|
351
358
|
|
352
359
|
p = [self.sim[hq[0][0]].prob(hq[0][1]), hq[1].prob(), self.sim[hq[2][0]].prob(hq[2][1])]
|
353
|
-
|
354
|
-
|
360
|
+
# Balancing suggestion from Elara (the custom OpenAI GPT)
|
361
|
+
prms = math.sqrt((p[0] ** 2 + p[1] ** 2 + p[2] ** 2) / 3)
|
362
|
+
qrms = math.sqrt(((1 - p[0]) ** 2 + (1 - p[1]) ** 2 + (1 - p[2]) ** 2) / 3)
|
363
|
+
result = ((prms + (1 - qrms)) / 2) >= 0.5
|
355
364
|
syndrome = [1 - p[0], 1 - p[1], 1 - p[2]] if result else [p[0], p[1], p[2]]
|
356
365
|
|
357
366
|
for q in range(3):
|
@@ -654,7 +663,7 @@ class QrackAceBackend:
|
|
654
663
|
if pauli != Pauli.PauliZ:
|
655
664
|
self._correct(lq2, False)
|
656
665
|
if pauli != Pauli.PauliX:
|
657
|
-
self.
|
666
|
+
self._correct(lq2, True)
|
658
667
|
|
659
668
|
def cx(self, lq1, lq2):
|
660
669
|
self._cpauli(lq1, lq2, False, Pauli.PauliX)
|
@@ -741,10 +750,15 @@ class QrackAceBackend:
|
|
741
750
|
|
742
751
|
self._correct(lq)
|
743
752
|
b0 = hq[0]
|
753
|
+
b1 = hq[1]
|
744
754
|
b2 = hq[2]
|
745
|
-
|
755
|
+
# RMS
|
756
|
+
p = [self.sim[b0[0]].prob(b0[1]), b1.prob(), self.sim[b2[0]].prob(b2[1])]
|
757
|
+
# Balancing suggestion from Elara (the custom OpenAI GPT)
|
758
|
+
prms = math.sqrt((p[0] ** 2 + p[1] ** 2 + p[2] ** 2) / 3)
|
759
|
+
qrms = math.sqrt(((1 - p[0]) ** 2 + (1 - p[1]) ** 2 + (1 - p[2]) ** 2) / 3)
|
746
760
|
|
747
|
-
return
|
761
|
+
return (prms + (1 - qrms)) / 2
|
748
762
|
|
749
763
|
def m(self, lq):
|
750
764
|
hq = self._unpack(lq)
|
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
|