pyqrack 1.60.0__py3-none-macosx_15_0_arm64.whl → 1.61.1__py3-none-macosx_15_0_arm64.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 might be problematic. Click here for more details.

@@ -332,7 +332,8 @@ class QrackAceBackend:
332
332
 
333
333
  # You can still "monkey-patch" this, after the constructor.
334
334
  if "QRACK_QUNIT_SEPARABILITY_THRESHOLD" not in os.environ:
335
- self.sim[i].set_sdrp(0.02375)
335
+ # (1 - 1 / sqrt(2)) / 4 (but empirically tuned)
336
+ self.sim[i].set_sdrp(0.073223304703363119)
336
337
 
337
338
  def clone(self):
338
339
  return QrackAceBackend(toClone=self)
@@ -442,49 +443,42 @@ class QrackAceBackend:
442
443
  def _get_lhv_bloch_angles(self, sim):
443
444
  # Z axis
444
445
  z = 1 - 2 * sim.prob(Pauli.PauliZ)
445
- prob = z**2
446
446
 
447
447
  # X axis
448
448
  x = 1 - 2 * sim.prob(Pauli.PauliX)
449
- prob += x**2
450
449
 
451
450
  # Y axis
452
451
  y = 1 - 2 * sim.prob(Pauli.PauliY)
453
- prob += y**2
454
452
 
455
- prob = math.sqrt(prob)
456
453
  inclination = math.atan2(math.sqrt(x**2 + y**2), z)
457
454
  azimuth = math.atan2(y, x)
458
455
 
459
- return prob, azimuth, inclination
456
+ return azimuth, inclination
460
457
 
461
458
  def _get_bloch_angles(self, hq):
462
- sim = self.sim[hq[0]]
459
+ sim = self.sim[hq[0]].clone()
463
460
  q = hq[1]
461
+ sim.separate([q])
464
462
 
465
463
  # Z axis
466
464
  z = 1 - 2 * sim.prob(q)
467
- prob = z**2
468
465
 
469
466
  # X axis
470
467
  sim.h(q)
471
468
  x = 1 - 2 * sim.prob(q)
472
- prob += x**2
473
469
  sim.h(q)
474
470
 
475
471
  # Y axis
476
472
  sim.adjs(q)
477
473
  sim.h(q)
478
474
  y = 1 - 2 * sim.prob(q)
479
- prob += y**2
480
475
  sim.h(q)
481
476
  sim.s(q)
482
477
 
483
- prob = math.sqrt(prob)
484
478
  inclination = math.atan2(math.sqrt(x**2 + y**2), z)
485
479
  azimuth = math.atan2(y, x)
486
480
 
487
- return prob, azimuth, inclination
481
+ return azimuth, inclination
488
482
 
489
483
  def _rotate_to_bloch(
490
484
  self, hq, delta_azimuth, delta_inclination
@@ -575,30 +569,25 @@ class QrackAceBackend:
575
569
  self.sim[hq[q][0]].x(hq[q][1])
576
570
 
577
571
  if not skip_rotation:
578
- p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
579
- p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
580
- p[1], a[1], i[1] = self._get_bloch_angles(hq[1])
581
- p[3], a[3], i[3] = self._get_bloch_angles(hq[3])
582
- p[4], a[4], i[4] = self._get_bloch_angles(hq[4])
572
+ a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
573
+ a[0], i[0] = self._get_bloch_angles(hq[0])
574
+ a[1], i[1] = self._get_bloch_angles(hq[1])
575
+ a[2], i[2] = self._get_lhv_bloch_angles(hq[2])
576
+ a[3], i[3] = self._get_bloch_angles(hq[3])
577
+ a[4], i[4] = self._get_bloch_angles(hq[4])
583
578
 
584
- indices = []
585
579
  a_target = 0
586
580
  i_target = 0
587
- weight = 0
588
581
  for x in range(5):
589
- if p[x] < 0.5:
590
- continue
591
- indices.append(x)
592
- w = (1.5 - p[x])
593
- w *= w
594
- a_target += w * a[x]
595
- i_target += w * i[x]
596
- weight += w
597
-
598
- if len(indices) > 1:
599
- a_target /= weight
600
- i_target /= weight
601
- for x in indices:
582
+ a_target += a[x]
583
+ i_target += i[x]
584
+
585
+ a_target /= 5
586
+ i_target /= 5
587
+ for x in range(5):
588
+ if x == 2:
589
+ self._rotate_lhv_to_bloch(hq[x], a_target - a[x], i_target - i[x])
590
+ else:
602
591
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
603
592
 
604
593
  else:
@@ -621,28 +610,23 @@ class QrackAceBackend:
621
610
  self.sim[hq[q][0]].x(hq[q][1])
622
611
 
623
612
  if not skip_rotation:
624
- p, a, i = [0, 0, 0], [0, 0, 0], [0, 0, 0]
625
- p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
626
- p[1], a[1], i[1] = self._get_bloch_angles(hq[1])
613
+ a, i = [0, 0, 0], [0, 0, 0]
614
+ a[0], i[0] = self._get_bloch_angles(hq[0])
615
+ a[1], i[1] = self._get_bloch_angles(hq[1])
616
+ a[2], i[2] = self._get_lhv_bloch_angles(hq[2])
627
617
 
628
- indices = []
629
618
  a_target = 0
630
619
  i_target = 0
631
- weight = 0
632
620
  for x in range(3):
633
- if p[x] < 0.5:
634
- continue
635
- indices.append(x)
636
- w = (1.5 - p[x])
637
- w *= w
638
- a_target += w * a[x]
639
- i_target += w * i[x]
640
- weight += w
641
-
642
- if len(indices) > 1:
643
- a_target /= weight
644
- i_target /= weight
645
- for x in indices:
621
+ a_target += a[x]
622
+ i_target += i[x]
623
+
624
+ a_target /= 5
625
+ i_target /= 5
626
+ for x in range(3):
627
+ if x == 2:
628
+ self._rotate_lhv_to_bloch(hq[x], a_target - a[x], i_target - i[x])
629
+ else:
646
630
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
647
631
 
648
632
  if phase:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyqrack
3
- Version: 1.60.0
3
+ Version: 1.61.1
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=_M03YHvczhw65gtg0ly8qlen7aOPDLC1K5gtM-cTgbI,48741
4
+ pyqrack/qrack_ace_backend.py,sha256=2O5JxL76w-QzrF1-D7yY1sa1MXjw6VKvATR9s3DZoj4,48358
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.dylib,sha256=V2_marSne0NGSonHzK5
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-1.60.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
- pyqrack-1.60.0.dist-info/METADATA,sha256=PVCNBbl44Lun0SlVUj1KJkFQRzDEkcVFD-rtR6ye4yI,5892
21
- pyqrack-1.60.0.dist-info/WHEEL,sha256=uKwoxROtjcnx4Gbh9Fbsan8Fm8wY5xdQpS0Bc4agBqM,106
22
- pyqrack-1.60.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
- pyqrack-1.60.0.dist-info/RECORD,,
19
+ pyqrack-1.61.1.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
+ pyqrack-1.61.1.dist-info/METADATA,sha256=oOcJTndhIrtyj6SIXXSgyO6jU_ETUcyk-Emv0h6rtSY,5892
21
+ pyqrack-1.61.1.dist-info/WHEEL,sha256=uKwoxROtjcnx4Gbh9Fbsan8Fm8wY5xdQpS0Bc4agBqM,106
22
+ pyqrack-1.61.1.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
+ pyqrack-1.61.1.dist-info/RECORD,,