pyqrack-cuda 1.58.5__tar.gz → 1.58.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.
Files changed (29) hide show
  1. {pyqrack_cuda-1.58.5/pyqrack_cuda.egg-info → pyqrack_cuda-1.58.7}/PKG-INFO +1 -1
  2. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_ace_backend.py +29 -43
  3. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
  4. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/setup.py +1 -1
  5. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/LICENSE +0 -0
  6. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/MANIFEST.in +0 -0
  7. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/Makefile +0 -0
  8. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/README.md +0 -0
  9. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyproject.toml +0 -0
  10. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/__init__.py +0 -0
  11. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/neuron_activation_fn.py +0 -0
  12. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/pauli.py +0 -0
  13. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_circuit.py +0 -0
  14. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_neuron.py +0 -0
  15. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_neuron_torch_layer.py +0 -0
  16. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_simulator.py +0 -0
  17. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_stabilizer.py +0 -0
  18. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_system/__init__.py +0 -0
  19. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_system/qrack_system.py +0 -0
  20. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/quimb_circuit_type.py +0 -0
  21. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/__init__.py +0 -0
  22. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/load_quantized_data.py +0 -0
  23. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/quantize_by_range.py +0 -0
  24. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
  25. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
  26. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
  27. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/requires.txt +0 -0
  28. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/top_level.txt +0 -0
  29. {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.58.5
3
+ Version: 1.58.7
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -443,20 +443,6 @@ class QrackAceBackend:
443
443
 
444
444
  return qb, lhv
445
445
 
446
- def get_lhv_bloch_angles(self, q):
447
- z = (1 - q.bloch[2]) / 2
448
- prob = z**2
449
- x = (1 - q.bloch[0]) / 2
450
- prob += x**2
451
- y = (1 - q.bloch[1]) / 2
452
- prob += y**2
453
-
454
- prob = math.sqrt(prob)
455
- inclination = math.atan2(math.sqrt(x**2 + y**2), z)
456
- azimuth = math.atan2(y, x)
457
-
458
- return prob, azimuth, inclination
459
-
460
446
  def get_bloch_angles(self, hq):
461
447
  sim = self.sim[hq[0]]
462
448
  q = hq[1]
@@ -485,24 +471,6 @@ class QrackAceBackend:
485
471
 
486
472
  return prob, azimuth, inclination
487
473
 
488
- def rotate_lhv_to_bloch(
489
- self, q, azimuth_curr, inclination_curr, azimuth_target, inclination_target
490
- ):
491
- delta_azimuth = azimuth_target - azimuth_curr
492
- delta_inclination = inclination_target - inclination_curr
493
-
494
- cosA = math.cos(delta_azimuth)
495
- sinA = math.sin(delta_azimuth)
496
- cosI = math.cos(delta_inclination / 2)
497
- sinI = math.sin(delta_inclination / 2)
498
-
499
- m00 = complex(cosI, 0)
500
- m01 = complex(-cosA, sinA) * sinI
501
- m10 = complex(cosA, sinA) * sinI
502
- m11 = complex(cosI, 0)
503
-
504
- q.mtrx([m00, m01, m10, m11])
505
-
506
474
  def rotate_to_bloch(
507
475
  self, hq, azimuth_curr, inclination_curr, azimuth_target, inclination_target
508
476
  ):
@@ -525,6 +493,18 @@ class QrackAceBackend:
525
493
 
526
494
  sim.mtrx([m00, m01, m10, m11], q)
527
495
 
496
+ def logit(self, x):
497
+ # Theoretically, these limit points are "infinite,"
498
+ # but precision caps out between 36 and 37:
499
+ if 5e-17 > (1 - x):
500
+ return 37
501
+ # For the negative limit, the precision caps out
502
+ # between -37 and -38
503
+ elif x < 1e-17:
504
+ return -38
505
+ return max(-38, min(37, math.log(x / (1 - x))))
506
+
507
+
528
508
  def _correct(self, lq, phase=False):
529
509
  hq = self._unpack(lq)
530
510
 
@@ -579,22 +559,25 @@ class QrackAceBackend:
579
559
  p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
580
560
  p[0], a[0], i[0] = self.get_bloch_angles(hq[0])
581
561
  p[1], a[1], i[1] = self.get_bloch_angles(hq[1])
582
- p[3], a[2], i[2] = self.get_bloch_angles(hq[3])
583
- p[4], a[3], i[3] = self.get_bloch_angles(hq[4])
562
+ p[3], a[3], i[3] = self.get_bloch_angles(hq[3])
563
+ p[4], a[4], i[4] = self.get_bloch_angles(hq[4])
584
564
 
585
565
  indices = []
586
566
  a_target = 0
587
567
  i_target = 0
588
- for x in range(4):
568
+ weight = 0
569
+ for x in range(5):
589
570
  if p[x] < 0.5:
590
571
  continue
591
572
  indices.append(x)
592
- a_target += a[x]
593
- i_target += i[x]
573
+ w = self.logit(1 - p[x])
574
+ a_target += w * a[x]
575
+ i_target += w * i[x]
576
+ weight += w
594
577
 
595
578
  if len(indices) > 1:
596
- a_target /= len(indices)
597
- i_target /= len(indices)
579
+ a_target /= weight
580
+ i_target /= weight
598
581
  for x in indices:
599
582
  self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
600
583
  else:
@@ -623,16 +606,19 @@ class QrackAceBackend:
623
606
  indices = []
624
607
  a_target = 0
625
608
  i_target = 0
609
+ weight = 0
626
610
  for x in range(2):
627
611
  if p[x] < 0.5:
628
612
  continue
629
613
  indices.append(x)
630
- a_target += a[x]
631
- i_target += i[x]
614
+ w = self.logit(1.0 - p[x])
615
+ a_target += x * a[x]
616
+ i_target += w * i[x]
617
+ weight += w
632
618
 
633
619
  if len(indices) > 1:
634
- a_target /= len(indices)
635
- i_target /= len(indices)
620
+ a_target /= weight
621
+ i_target /= weight
636
622
  for x in indices:
637
623
  self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
638
624
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.58.5
3
+ Version: 1.58.7
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.58.5"
10
+ VERSION = "1.58.7"
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