pyqrack-cpu 1.61.3__py3-none-manylinux_2_35_x86_64.whl → 1.62.0__py3-none-manylinux_2_35_x86_64.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 pyqrack-cpu might be problematic. Click here for more details.

@@ -45,6 +45,7 @@ class QrackAceBackend:
45
45
  sim(QrackSimulator): Array of simulators corresponding to "patches" between boundary rows.
46
46
  long_range_columns(int): How many ideal rows between QEC boundary rows?
47
47
  is_transpose(bool): Rows are long if False, columns are long if True
48
+ correction_bias(float): Bias magnitude and direction during pseudo-QEC
48
49
  """
49
50
 
50
51
  def __init__(
@@ -53,6 +54,7 @@ class QrackAceBackend:
53
54
  long_range_columns=4,
54
55
  long_range_rows=4,
55
56
  is_transpose=False,
57
+ correction_bias=0,
56
58
  isTensorNetwork=False,
57
59
  isSchmidtDecomposeMulti=False,
58
60
  isSchmidtDecompose=True,
@@ -81,6 +83,7 @@ class QrackAceBackend:
81
83
  self.long_range_columns = long_range_columns
82
84
  self.long_range_rows = long_range_rows
83
85
  self.is_transpose = is_transpose
86
+ self.correction_bias = correction_bias
84
87
 
85
88
  fppow = 5
86
89
  if "QRACK_FPPOW" in os.environ:
@@ -116,10 +119,9 @@ class QrackAceBackend:
116
119
  self._is_row_long_range[-1] = False
117
120
  sim_count = col_patch_count * row_patch_count
118
121
 
119
- self._qubit_dict = {}
122
+ self._qubits = []
120
123
  sim_counts = [0] * sim_count
121
124
  sim_id = 0
122
- tot_qubits = 0
123
125
  for r in self._is_row_long_range:
124
126
  for c in self._is_col_long_range:
125
127
  qubit = [(sim_id, sim_counts[sim_id])]
@@ -142,8 +144,7 @@ class QrackAceBackend:
142
144
  if not c:
143
145
  sim_id = (sim_id + 1) % sim_count
144
146
 
145
- self._qubit_dict[tot_qubits] = qubit
146
- tot_qubits += 1
147
+ self._qubits.append(qubit)
147
148
 
148
149
  self.sim = []
149
150
  for i in range(sim_count):
@@ -259,7 +260,7 @@ class QrackAceBackend:
259
260
  self._qec_x(c)
260
261
 
261
262
  def _unpack(self, lq):
262
- return self._qubit_dict[lq]
263
+ return self._qubits[lq]
263
264
 
264
265
  def _get_qb_indices(self, hq):
265
266
  qb = []
@@ -352,7 +353,7 @@ class QrackAceBackend:
352
353
  self.sim[hq[q][0]].x(hq[q][1])
353
354
 
354
355
  if not skip_rotation:
355
- a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
356
+ a, i = [0, 0, 0, 0], [0, 0, 0, 0]
356
357
  a[0], i[0] = self._get_bloch_angles(hq[0])
357
358
  a[1], i[1] = self._get_bloch_angles(hq[1])
358
359
  a[2], i[2] = self._get_bloch_angles(hq[3])
@@ -369,6 +370,8 @@ class QrackAceBackend:
369
370
  for x in range(4):
370
371
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
371
372
 
373
+ self.apply_magnetic_bias([lq], self.correction_bias)
374
+
372
375
  else:
373
376
  # RMS
374
377
  p = [
@@ -385,7 +388,7 @@ class QrackAceBackend:
385
388
  self.sim[hq[q][0]].x(hq[q][1])
386
389
 
387
390
  if not skip_rotation:
388
- a, i = [0, 0, 0], [0, 0, 0]
391
+ a, i = [0, 0], [0, 0]
389
392
  a[0], i[0] = self._get_bloch_angles(hq[0])
390
393
  a[1], i[1] = self._get_bloch_angles(hq[1])
391
394
 
@@ -400,11 +403,25 @@ class QrackAceBackend:
400
403
  for x in range(2):
401
404
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
402
405
 
406
+ self.apply_magnetic_bias([lq], self.correction_bias)
407
+
403
408
  if phase:
404
409
  for q in qb:
405
410
  b = hq[q]
406
411
  self.sim[b[0]].h(b[1])
407
412
 
413
+ def apply_magnetic_bias(self, q, b):
414
+ if b == 0:
415
+ return
416
+ b = math.exp(b)
417
+ for x in q:
418
+ hq = self._unpack(x)
419
+ for h in hq:
420
+ a, i = self._get_bloch_angles(h)
421
+ self._rotate_to_bloch(
422
+ h, math.atan(math.tan(a) * b) - a, math.atan(math.tan(i) * b) - i
423
+ )
424
+
408
425
  def u(self, lq, th, ph, lm):
409
426
  hq = self._unpack(lq)
410
427
  if len(hq) < 2:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyqrack-cpu
3
- Version: 1.61.3
3
+ Version: 1.62.0
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -1,7 +1,7 @@
1
1
  pyqrack/__init__.py,sha256=3tBwfCCD-zQjQ2g1EUZdggKdn-3b2uSFTbT7LS0YLaU,785
2
2
  pyqrack/neuron_activation_fn.py,sha256=fQTTFfsvwcot_43Vopacot47IV2Rxk8pelUyuzwpXPs,593
3
3
  pyqrack/pauli.py,sha256=wg500wDOwdIU4lEVJoMmjtbAdmtakZYzLPjdzC2rwUQ,654
4
- pyqrack/qrack_ace_backend.py,sha256=1ibcuK68O2hwW8AzzxHLURXcjuQ13HKU-nIVZPLYJIg,39752
4
+ pyqrack/qrack_ace_backend.py,sha256=SLmRwJmUAzV0BWoZJFskMYl21Kg9VXjQnoaAb4g6eDk,40334
5
5
  pyqrack/qrack_circuit.py,sha256=vDCKGbcEHJDFUKprjCpWgit8lXFnMrPimKHURD2_Hj4,19538
6
6
  pyqrack/qrack_neuron.py,sha256=UiJdjAGB6usjAGHWSosSFCUUeIkhh3MtZbsaxfsIsNw,9043
7
7
  pyqrack/qrack_neuron_torch_layer.py,sha256=Bs5BLC2GFevfSpo_jSJ2AZl-hfDRJmzlGN9pFw1CtoQ,6160
@@ -16,8 +16,8 @@ pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.so.9.22.0,sha256=uFHqafF8aaXe5tH
16
16
  pyqrack/stats/__init__.py,sha256=Hla85my2fY_roR9lIjGBVpEG7ySOTMwjWa8D6-kgCnY,276
17
17
  pyqrack/stats/load_quantized_data.py,sha256=z12u9F7Nt3P-i44nY1xxvso_klS6WIHS3iqq7R2_lqE,1184
18
18
  pyqrack/stats/quantize_by_range.py,sha256=UM0_7jJDdQ7g30cR3UQAxkbzkqrmsy1oUfqg0h11FUY,2270
19
- pyqrack_cpu-1.61.3.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
- pyqrack_cpu-1.61.3.dist-info/METADATA,sha256=itC4lHXwqtvFmC1alYDxeEKxQFGv1gPi71vZCxQKutA,5971
21
- pyqrack_cpu-1.61.3.dist-info/WHEEL,sha256=AMMNaGlKLEICDqgnxZojk7k8N6wUjQQ3X9tPjxJ2sOc,110
22
- pyqrack_cpu-1.61.3.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
- pyqrack_cpu-1.61.3.dist-info/RECORD,,
19
+ pyqrack_cpu-1.62.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
+ pyqrack_cpu-1.62.0.dist-info/METADATA,sha256=szlF9V6pWiHUSKtCECt9oJqDxDqS2_rZjjL9Z_ahX_U,5971
21
+ pyqrack_cpu-1.62.0.dist-info/WHEEL,sha256=AMMNaGlKLEICDqgnxZojk7k8N6wUjQQ3X9tPjxJ2sOc,110
22
+ pyqrack_cpu-1.62.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
+ pyqrack_cpu-1.62.0.dist-info/RECORD,,