pyqrack-cuda 1.49.5__tar.gz → 1.49.8__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.49.5/pyqrack_cuda.egg-info → pyqrack_cuda-1.49.8}/PKG-INFO +1 -1
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_ace_backend.py +85 -16
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/setup.py +1 -1
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/LICENSE +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/Makefile +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/README.md +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyproject.toml +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.49.5 → pyqrack_cuda-1.49.8}/setup.cfg +0 -0
@@ -19,6 +19,12 @@ try:
|
|
19
19
|
except ImportError:
|
20
20
|
_IS_QISKIT_AVAILABLE = False
|
21
21
|
|
22
|
+
_IS_QISKIT_AER_AVAILABLE = True
|
23
|
+
try:
|
24
|
+
from qiskit_aer.noise import NoiseModel, depolarizing_error
|
25
|
+
except ImportError:
|
26
|
+
_IS_QISKIT_AER_AVAILABLE = False
|
27
|
+
|
22
28
|
|
23
29
|
class QrackAceBackend:
|
24
30
|
"""A back end for elided quantum error correction
|
@@ -62,11 +68,12 @@ class QrackAceBackend:
|
|
62
68
|
self.alternating_codes = alternating_codes
|
63
69
|
self.long_range_columns = long_range_columns
|
64
70
|
self._is_init = [False] * qubit_count
|
71
|
+
self._coupling_map = None
|
65
72
|
|
66
73
|
# If there's only one or zero "False" columns,
|
67
74
|
# the entire simulator is connected, anyway.
|
68
75
|
if (long_range_columns + 1) >= self.row_length:
|
69
|
-
self._is_col_long_range = [True] *
|
76
|
+
self._is_col_long_range = [True] * self.row_length
|
70
77
|
else:
|
71
78
|
col_seq = [True] * long_range_columns + [False]
|
72
79
|
len_col_seq = len(col_seq)
|
@@ -333,12 +340,15 @@ class QrackAceBackend:
|
|
333
340
|
|
334
341
|
if not math.isclose(ph, -lm) and not math.isclose(abs(ph), math.pi / 2):
|
335
342
|
# Produces/destroys superposition
|
336
|
-
self.
|
337
|
-
|
343
|
+
if self._is_init[lq]:
|
344
|
+
self._correct_if_like_h(th, lq)
|
345
|
+
self.sim.mcx([hq[0]], hq[1])
|
338
346
|
self.sim.u(hq[0], th, ph, lm)
|
339
|
-
|
340
|
-
|
341
|
-
|
347
|
+
self.sim.u(hq[2], th, ph, lm)
|
348
|
+
if self._is_init[lq]:
|
349
|
+
self.sim.mcx([hq[0]], hq[1])
|
350
|
+
else:
|
351
|
+
self._encode(lq, hq)
|
342
352
|
else:
|
343
353
|
# Shouldn't produce/destroy superposition
|
344
354
|
for b in hq:
|
@@ -354,7 +364,7 @@ class QrackAceBackend:
|
|
354
364
|
th -= 2 * math.pi
|
355
365
|
while th <= -math.pi:
|
356
366
|
th += 2 * math.pi
|
357
|
-
if p == Pauli.PauliY:
|
367
|
+
if self._is_init[lq] and (p == Pauli.PauliY):
|
358
368
|
self._correct_if_like_h(th, lq)
|
359
369
|
|
360
370
|
if (p == Pauli.PauliZ) or math.isclose(abs(th), math.pi):
|
@@ -363,11 +373,14 @@ class QrackAceBackend:
|
|
363
373
|
self.sim.r(p, th, b)
|
364
374
|
else:
|
365
375
|
# Produces/destroys superposition
|
366
|
-
self.
|
376
|
+
if self._is_init[lq]:
|
377
|
+
self.sim.mcx([hq[0]], hq[1])
|
367
378
|
self.sim.r(p, th, hq[0])
|
368
|
-
|
369
|
-
|
370
|
-
|
379
|
+
self.sim.r(p, th, hq[2])
|
380
|
+
if self._is_init[lq]:
|
381
|
+
self.sim.mcx([hq[0]], hq[1])
|
382
|
+
else:
|
383
|
+
self._encode(lq, hq)
|
371
384
|
|
372
385
|
def h(self, lq):
|
373
386
|
hq = self._unpack(lq)
|
@@ -375,11 +388,15 @@ class QrackAceBackend:
|
|
375
388
|
self.sim.h(hq[0])
|
376
389
|
return
|
377
390
|
|
378
|
-
self.
|
391
|
+
self._correct(lq)
|
392
|
+
if self._is_init[lq]:
|
393
|
+
self.sim.mcx([hq[0]], hq[1])
|
379
394
|
self.sim.h(hq[0])
|
380
|
-
|
381
|
-
|
382
|
-
|
395
|
+
self.sim.h(hq[2])
|
396
|
+
if self._is_init[lq]:
|
397
|
+
self.sim.mcx([hq[0]], hq[1])
|
398
|
+
else:
|
399
|
+
self._encode(lq, hq)
|
383
400
|
|
384
401
|
def s(self, lq):
|
385
402
|
hq = self._unpack(lq)
|
@@ -1093,6 +1110,9 @@ class QrackAceBackend:
|
|
1093
1110
|
|
1094
1111
|
# Mostly written by Dan, but with a little help from Elara (custom OpenAI GPT)
|
1095
1112
|
def get_logical_coupling_map(self):
|
1113
|
+
if self._coupling_map:
|
1114
|
+
return self._coupling_map
|
1115
|
+
|
1096
1116
|
coupling_map = set()
|
1097
1117
|
rows, cols = self.row_length, self.col_length
|
1098
1118
|
|
@@ -1123,4 +1143,53 @@ class QrackAceBackend:
|
|
1123
1143
|
if a != b:
|
1124
1144
|
coupling_map.add((a, b))
|
1125
1145
|
|
1126
|
-
|
1146
|
+
self._coupling_map = sorted(coupling_map)
|
1147
|
+
|
1148
|
+
return self._coupling_map
|
1149
|
+
|
1150
|
+
# Designed by Dan, and implemented by Elara:
|
1151
|
+
def create_noise_model(self, x=0.25, y=0.25):
|
1152
|
+
if not _IS_QISKIT_AER_AVAILABLE:
|
1153
|
+
raise RuntimeError(
|
1154
|
+
"Before trying to run_qiskit_circuit() with QrackAceBackend, you must install Qiskit Aer!"
|
1155
|
+
)
|
1156
|
+
noise_model = NoiseModel()
|
1157
|
+
|
1158
|
+
for a, b in self.get_logical_coupling_map():
|
1159
|
+
col_a, col_b = a % self.row_length, b % self.row_length
|
1160
|
+
row_a, row_b = a // self.row_length, b // self.row_length
|
1161
|
+
is_long_a = self._is_col_long_range[col_a]
|
1162
|
+
is_long_b = self._is_col_long_range[col_b]
|
1163
|
+
|
1164
|
+
if is_long_a and is_long_b:
|
1165
|
+
continue # No noise on long-to-long
|
1166
|
+
|
1167
|
+
same_col = col_a == col_b
|
1168
|
+
even_odd = (row_a % 2) != (row_b % 2)
|
1169
|
+
|
1170
|
+
if same_col and not even_odd:
|
1171
|
+
continue # No noise for even-even or odd-odd within a boundary column
|
1172
|
+
|
1173
|
+
if same_col:
|
1174
|
+
x_cy = 1 - (1 - x)**2
|
1175
|
+
x_swap = 1 - (1 - x)**3
|
1176
|
+
noise_model.add_quantum_error(depolarizing_error(x, 2), 'cx', [a, b])
|
1177
|
+
noise_model.add_quantum_error(depolarizing_error(x_cy, 2), 'cy', [a, b])
|
1178
|
+
noise_model.add_quantum_error(depolarizing_error(x_cy, 2), 'cz', [a, b])
|
1179
|
+
noise_model.add_quantum_error(depolarizing_error(x_swap, 2), 'swap', [a, b])
|
1180
|
+
elif is_long_a or is_long_b:
|
1181
|
+
y_cy = 1 - (1 - y)**2
|
1182
|
+
y_swap = 1 - (1 - y)**3
|
1183
|
+
noise_model.add_quantum_error(depolarizing_error(y, 2), 'cx', [a, b])
|
1184
|
+
noise_model.add_quantum_error(depolarizing_error(y_cy, 2), 'cy', [a, b])
|
1185
|
+
noise_model.add_quantum_error(depolarizing_error(y_cy, 2), 'cz', [a, b])
|
1186
|
+
noise_model.add_quantum_error(depolarizing_error(y_swap, 2), 'swap', [a, b])
|
1187
|
+
else:
|
1188
|
+
y_cy = 1 - (1 - y)**2
|
1189
|
+
y_swap = 1 - (1 - y)**3
|
1190
|
+
noise_model.add_quantum_error(depolarizing_error(y_cy, 2), 'cx', [a, b])
|
1191
|
+
noise_model.add_quantum_error(depolarizing_error(y_cy, 2), 'cy', [a, b])
|
1192
|
+
noise_model.add_quantum_error(depolarizing_error(y_cy, 2), 'cz', [a, b])
|
1193
|
+
noise_model.add_quantum_error(depolarizing_error(y_swap, 2), 'swap', [a, b])
|
1194
|
+
|
1195
|
+
return noise_model
|
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
|