pyqrack-cpu 1.61.0__py3-none-macosx_13_0_x86_64.whl → 1.61.2__py3-none-macosx_13_0_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.

@@ -443,49 +443,42 @@ class QrackAceBackend:
443
443
  def _get_lhv_bloch_angles(self, sim):
444
444
  # Z axis
445
445
  z = 1 - 2 * sim.prob(Pauli.PauliZ)
446
- prob = z**2
447
446
 
448
447
  # X axis
449
448
  x = 1 - 2 * sim.prob(Pauli.PauliX)
450
- prob += x**2
451
449
 
452
450
  # Y axis
453
451
  y = 1 - 2 * sim.prob(Pauli.PauliY)
454
- prob += y**2
455
452
 
456
- prob = math.sqrt(prob)
457
453
  inclination = math.atan2(math.sqrt(x**2 + y**2), z)
458
454
  azimuth = math.atan2(y, x)
459
455
 
460
- return prob, azimuth, inclination
456
+ return azimuth, inclination
461
457
 
462
458
  def _get_bloch_angles(self, hq):
463
- sim = self.sim[hq[0]]
459
+ sim = self.sim[hq[0]].clone()
464
460
  q = hq[1]
461
+ sim.separate([q])
465
462
 
466
463
  # Z axis
467
464
  z = 1 - 2 * sim.prob(q)
468
- prob = z**2
469
465
 
470
466
  # X axis
471
467
  sim.h(q)
472
468
  x = 1 - 2 * sim.prob(q)
473
- prob += x**2
474
469
  sim.h(q)
475
470
 
476
471
  # Y axis
477
472
  sim.adjs(q)
478
473
  sim.h(q)
479
474
  y = 1 - 2 * sim.prob(q)
480
- prob += y**2
481
475
  sim.h(q)
482
476
  sim.s(q)
483
477
 
484
- prob = math.sqrt(prob)
485
478
  inclination = math.atan2(math.sqrt(x**2 + y**2), z)
486
479
  azimuth = math.atan2(y, x)
487
480
 
488
- return prob, azimuth, inclination
481
+ return azimuth, inclination
489
482
 
490
483
  def _rotate_to_bloch(
491
484
  self, hq, delta_azimuth, delta_inclination
@@ -576,30 +569,25 @@ class QrackAceBackend:
576
569
  self.sim[hq[q][0]].x(hq[q][1])
577
570
 
578
571
  if not skip_rotation:
579
- p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
580
- p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
581
- p[1], a[1], i[1] = self._get_bloch_angles(hq[1])
582
- p[3], a[3], i[3] = self._get_bloch_angles(hq[3])
583
- 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])
584
578
 
585
- indices = []
586
579
  a_target = 0
587
580
  i_target = 0
588
- weight = 0
589
581
  for x in range(5):
590
- if p[x] < 0.5:
591
- continue
592
- indices.append(x)
593
- w = (1.5 - p[x])
594
- w *= w
595
- a_target += w * a[x]
596
- i_target += w * i[x]
597
- weight += w
598
-
599
- if len(indices) > 1:
600
- a_target /= weight
601
- i_target /= weight
602
- 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:
603
591
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
604
592
 
605
593
  else:
@@ -622,28 +610,23 @@ class QrackAceBackend:
622
610
  self.sim[hq[q][0]].x(hq[q][1])
623
611
 
624
612
  if not skip_rotation:
625
- p, a, i = [0, 0, 0], [0, 0, 0], [0, 0, 0]
626
- p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
627
- 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])
628
617
 
629
- indices = []
630
618
  a_target = 0
631
619
  i_target = 0
632
- weight = 0
633
620
  for x in range(3):
634
- if p[x] < 0.5:
635
- continue
636
- indices.append(x)
637
- w = (1.5 - p[x])
638
- w *= w
639
- a_target += w * a[x]
640
- i_target += w * i[x]
641
- weight += w
642
-
643
- if len(indices) > 1:
644
- a_target /= weight
645
- i_target /= weight
646
- for x in indices:
621
+ a_target += a[x]
622
+ i_target += i[x]
623
+
624
+ a_target /= 3
625
+ i_target /= 3
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:
647
630
  self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
648
631
 
649
632
  if phase:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyqrack-cpu
3
- Version: 1.61.0
3
+ Version: 1.61.2
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=YNrG-Yte5pq7L81G0GzLyL1uEhuOMNkXq8C8eLxo_FY,48818
4
+ pyqrack/qrack_ace_backend.py,sha256=x1s_I_YijLsKkhkQPWZUUQNHiJom_uTjGFoqz1cgDQQ,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=Cdb_wa2cG_V5lzswBH4
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.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
- pyqrack_cpu-1.61.0.dist-info/METADATA,sha256=cvRYRJwOGuX9K_HsD55ALKOKt-CCmx6eFmdljhJC4AE,5951
21
- pyqrack_cpu-1.61.0.dist-info/WHEEL,sha256=nZx8s83OrgdDmpcWX-8FgI0sEAjdQimt4SdYsdcCaC8,107
22
- pyqrack_cpu-1.61.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
- pyqrack_cpu-1.61.0.dist-info/RECORD,,
19
+ pyqrack_cpu-1.61.2.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
20
+ pyqrack_cpu-1.61.2.dist-info/METADATA,sha256=BzwhQQ7tAt2oQ4IqtDrLcmbP00EybPVvg690dg7mhIg,5951
21
+ pyqrack_cpu-1.61.2.dist-info/WHEEL,sha256=nZx8s83OrgdDmpcWX-8FgI0sEAjdQimt4SdYsdcCaC8,107
22
+ pyqrack_cpu-1.61.2.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
23
+ pyqrack_cpu-1.61.2.dist-info/RECORD,,