pyqrack-cuda 1.55.0__tar.gz → 1.55.2__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.
Files changed (29) hide show
  1. {pyqrack_cuda-1.55.0/pyqrack_cuda.egg-info → pyqrack_cuda-1.55.2}/PKG-INFO +1 -1
  2. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_ace_backend.py +46 -9
  3. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_simulator.py +2 -2
  4. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
  5. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/setup.py +1 -1
  6. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/LICENSE +0 -0
  7. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/MANIFEST.in +0 -0
  8. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/Makefile +0 -0
  9. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/README.md +0 -0
  10. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyproject.toml +0 -0
  11. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/__init__.py +0 -0
  12. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/neuron_activation_fn.py +0 -0
  13. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/pauli.py +0 -0
  14. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_circuit.py +0 -0
  15. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_neuron.py +0 -0
  16. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_neuron_torch_layer.py +0 -0
  17. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_stabilizer.py +0 -0
  18. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_system/__init__.py +0 -0
  19. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/qrack_system/qrack_system.py +0 -0
  20. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/quimb_circuit_type.py +0 -0
  21. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/stats/__init__.py +0 -0
  22. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/stats/load_quantized_data.py +0 -0
  23. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack/stats/quantize_by_range.py +0 -0
  24. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
  25. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
  26. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
  27. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack_cuda.egg-info/requires.txt +0 -0
  28. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/pyqrack_cuda.egg-info/top_level.txt +0 -0
  29. {pyqrack_cuda-1.55.0 → pyqrack_cuda-1.55.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.55.0
3
+ Version: 1.55.2
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -121,6 +121,7 @@ class LHVQubit:
121
121
  self.x()
122
122
  return result
123
123
 
124
+
124
125
  # Provided by Elara (the custom OpenAI GPT)
125
126
  def _cpauli_lhv(prob, targ, axis, anti, theta=math.pi):
126
127
  """
@@ -143,6 +144,7 @@ def _cpauli_lhv(prob, targ, axis, anti, theta=math.pi):
143
144
  elif axis == Pauli.PauliZ:
144
145
  targ.rz(effective_theta)
145
146
 
147
+
146
148
  class QrackAceBackend:
147
149
  """A back end for elided quantum error correction
148
150
 
@@ -186,6 +188,16 @@ class QrackAceBackend:
186
188
  self.long_range_columns = long_range_columns
187
189
  self.is_transpose = is_transpose
188
190
 
191
+ fppow = 5
192
+ if "QRACK_FPPOW" in os.environ:
193
+ fppow = int(os.environ.get("QRACK_FPPOW"))
194
+ if fppow < 5:
195
+ self._epsilon = 2**-11
196
+ elif fppow > 5:
197
+ self._epsilon = 2**-53
198
+ else:
199
+ self._epsilon = 2**-24
200
+
189
201
  self._coupling_map = None
190
202
 
191
203
  # If there's only one or zero "False" columns,
@@ -218,7 +230,9 @@ class QrackAceBackend:
218
230
  tot_qubits += 1
219
231
  sim_counts[sim_id] += 1
220
232
 
221
- self._lhv_dict[tot_qubits] = LHVQubit(toClone = toClone._lhv_dict[tot_qubits] if toClone else None)
233
+ self._lhv_dict[tot_qubits] = LHVQubit(
234
+ toClone=toClone._lhv_dict[tot_qubits] if toClone else None
235
+ )
222
236
  tot_qubits += 1
223
237
 
224
238
  sim_id = (sim_id + 1) % sim_count
@@ -262,7 +276,9 @@ class QrackAceBackend:
262
276
  col_len -= 1
263
277
  row_len = width // col_len
264
278
 
265
- self._col_length, self._row_length = (row_len, col_len) if is_transpose else (col_len, row_len)
279
+ self._col_length, self._row_length = (
280
+ (row_len, col_len) if is_transpose else (col_len, row_len)
281
+ )
266
282
 
267
283
  def _ct_pair_prob(self, q1, q2):
268
284
  p1 = self.sim[q1[0]].prob(q1[1]) if isinstance(q1, tuple) else q1.prob()
@@ -356,7 +372,12 @@ class QrackAceBackend:
356
372
  b = hq[2]
357
373
  self.sim[b[0]].h(b[1])
358
374
 
359
- p = [self.sim[hq[0][0]].prob(hq[0][1]), hq[1].prob(), self.sim[hq[2][0]].prob(hq[2][1])]
375
+ # RMS
376
+ p = [
377
+ self.sim[hq[0][0]].prob(hq[0][1]),
378
+ hq[1].prob(),
379
+ self.sim[hq[2][0]].prob(hq[2][1]),
380
+ ]
360
381
  # Balancing suggestion from Elara (the custom OpenAI GPT)
361
382
  prms = math.sqrt((p[0] ** 2 + p[1] ** 2 + p[2] ** 2) / 3)
362
383
  qrms = math.sqrt(((1 - p[0]) ** 2 + (1 - p[1]) ** 2 + (1 - p[2]) ** 2) / 3)
@@ -565,14 +586,16 @@ class QrackAceBackend:
565
586
  hq2 = self._unpack(lq2)
566
587
 
567
588
  if lq1_lr and lq2_lr:
568
- connected = (lq1_col == lq2_col) or ((self.long_range_columns + 1) >= self._row_length)
589
+ connected = (lq1_col == lq2_col) or (
590
+ (self.long_range_columns + 1) >= self._row_length
591
+ )
569
592
  c = (lq1_col - 1) % self._row_length
570
593
  while not connected and self._is_col_long_range[c]:
571
- connected = (lq2_col == c)
594
+ connected = lq2_col == c
572
595
  c = (c - 1) % self._row_length
573
596
  c = (lq1_col + 1) % self._row_length
574
597
  while not connected and self._is_col_long_range[c]:
575
- connected = (lq2_col == c)
598
+ connected = lq2_col == c
576
599
  c = (c + 1) % self._row_length
577
600
 
578
601
  b1 = hq1[0]
@@ -766,15 +789,29 @@ class QrackAceBackend:
766
789
  b = hq[0]
767
790
  return self.sim[b[0]].m(b[1])
768
791
 
769
- result = (random.random() < self.prob(lq))
792
+ p = self.prob(lq)
793
+ result = ((p + self._epsilon) >= 1) or (random.random() < p)
794
+
770
795
  b = hq[0]
771
- self.sim[b[0]].force_m(b[1], result)
796
+ p = self.sim[b[0]].prob(b[1]) if result else (1 - self.sim[b[0]].prob(b[1]))
797
+ if p < self._epsilon:
798
+ if self.sim[b[0]].m(b[1]):
799
+ self.sim[b[0]].x(b[1])
800
+ else:
801
+ self.sim[b[0]].force_m(b[1], result)
802
+
772
803
  b = hq[1]
773
804
  b.reset()
774
805
  if result:
775
806
  b.x()
807
+
776
808
  b = hq[2]
777
- self.sim[b[0]].force_m(b[1], result)
809
+ p = self.sim[b[0]].prob(b[1]) if result else (1 - self.sim[b[0]].prob(b[1]))
810
+ if p < self._epsilon:
811
+ if self.sim[b[0]].m(b[1]):
812
+ self.sim[b[0]].x(b[1])
813
+ else:
814
+ self.sim[b[0]].force_m(b[1], result)
778
815
 
779
816
  return result
780
817
 
@@ -181,12 +181,12 @@ class QrackSimulator:
181
181
  self._throw_if_error()
182
182
 
183
183
  def set_concurrency(self, p):
184
- """ Set the CPU parallel thread count"""
184
+ """Set the CPU parallel thread count"""
185
185
  Qrack.qrack_lib.set_concurrency(self.sid, p)
186
186
  self._throw_if_error()
187
187
 
188
188
  def set_device(self, d):
189
- """ Set the GPU device ID"""
189
+ """Set the GPU device ID"""
190
190
  Qrack.qrack_lib.set_device(self.sid, d)
191
191
  self._throw_if_error()
192
192
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.55.0
3
+ Version: 1.55.2
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -7,7 +7,7 @@ from setuptools import setup
7
7
  from setuptools.command.build_py import build_py
8
8
 
9
9
 
10
- VERSION = "1.55.0"
10
+ VERSION = "1.55.2"
11
11
 
12
12
  # Read long description from README.
13
13
  README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')
File without changes
File without changes
File without changes
File without changes
File without changes