pyqrack-cuda 1.58.8__tar.gz → 1.58.10__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.
- {pyqrack_cuda-1.58.8/pyqrack_cuda.egg-info → pyqrack_cuda-1.58.10}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_ace_backend.py +95 -57
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/setup.py +1 -1
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/LICENSE +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/Makefile +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/README.md +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyproject.toml +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.58.8 → pyqrack_cuda-1.58.10}/setup.cfg +0 -0
@@ -443,7 +443,26 @@ class QrackAceBackend:
|
|
443
443
|
|
444
444
|
return qb, lhv
|
445
445
|
|
446
|
-
def
|
446
|
+
def _get_lhv_bloch_angles(self, sim):
|
447
|
+
# Z axis
|
448
|
+
z = 1 - 2 * sim.prob(Pauli.PauliZ)
|
449
|
+
prob = z**2
|
450
|
+
|
451
|
+
# X axis
|
452
|
+
x = 1 - 2 * sim.prob(Pauli.PauliX)
|
453
|
+
prob += x**2
|
454
|
+
|
455
|
+
# Y axis
|
456
|
+
y = 1 - 2 * sim.prob(Pauli.PauliY)
|
457
|
+
prob += y**2
|
458
|
+
|
459
|
+
prob = math.sqrt(prob)
|
460
|
+
inclination = math.atan2(math.sqrt(x**2 + y**2), z)
|
461
|
+
azimuth = math.atan2(y, x)
|
462
|
+
|
463
|
+
return prob, azimuth, inclination
|
464
|
+
|
465
|
+
def _get_bloch_angles(self, hq):
|
447
466
|
sim = self.sim[hq[0]]
|
448
467
|
q = hq[1]
|
449
468
|
|
@@ -471,15 +490,12 @@ class QrackAceBackend:
|
|
471
490
|
|
472
491
|
return prob, azimuth, inclination
|
473
492
|
|
474
|
-
def
|
475
|
-
self, hq,
|
493
|
+
def _rotate_to_bloch(
|
494
|
+
self, hq, delta_azimuth, delta_inclination
|
476
495
|
):
|
477
496
|
sim = self.sim[hq[0]]
|
478
497
|
q = hq[1]
|
479
498
|
|
480
|
-
delta_azimuth = azimuth_target - azimuth_curr
|
481
|
-
delta_inclination = inclination_target - inclination_curr
|
482
|
-
|
483
499
|
# Apply rotation as "Azimuth, Inclination" (AI)
|
484
500
|
cosA = math.cos(delta_azimuth)
|
485
501
|
sinA = math.sin(delta_azimuth)
|
@@ -494,7 +510,24 @@ class QrackAceBackend:
|
|
494
510
|
sim.mtrx([m00, m01, m10, m11], q)
|
495
511
|
|
496
512
|
|
497
|
-
def
|
513
|
+
def _rotate_lhv_to_bloch(
|
514
|
+
self, sim, delta_azimuth, delta_inclination
|
515
|
+
):
|
516
|
+
# Apply rotation as "Azimuth, Inclination" (AI)
|
517
|
+
cosA = math.cos(delta_azimuth)
|
518
|
+
sinA = math.sin(delta_azimuth)
|
519
|
+
cosI = math.cos(delta_inclination / 2)
|
520
|
+
sinI = math.sin(delta_inclination / 2)
|
521
|
+
|
522
|
+
m00 = complex(cosI, 0)
|
523
|
+
m01 = complex(-cosA, sinA) * sinI
|
524
|
+
m10 = complex(cosA, sinA) * sinI
|
525
|
+
m11 = complex(cosI, 0)
|
526
|
+
|
527
|
+
sim.mtrx([m00, m01, m10, m11])
|
528
|
+
|
529
|
+
|
530
|
+
def _correct(self, lq, phase=False, skip_rotation=False):
|
498
531
|
hq = self._unpack(lq)
|
499
532
|
|
500
533
|
if len(hq) == 1:
|
@@ -545,30 +578,33 @@ class QrackAceBackend:
|
|
545
578
|
else:
|
546
579
|
self.sim[hq[q][0]].x(hq[q][1])
|
547
580
|
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
581
|
+
if not skip_rotation:
|
582
|
+
p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
|
583
|
+
p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
|
584
|
+
p[1], a[1], i[1] = self._get_bloch_angles(hq[1])
|
585
|
+
p[3], a[3], i[3] = self._get_bloch_angles(hq[3])
|
586
|
+
p[4], a[4], i[4] = self._get_bloch_angles(hq[4])
|
587
|
+
|
588
|
+
indices = []
|
589
|
+
a_target = 0
|
590
|
+
i_target = 0
|
591
|
+
weight = 0
|
592
|
+
for x in range(5):
|
593
|
+
if p[x] < 0.5:
|
594
|
+
continue
|
595
|
+
indices.append(x)
|
596
|
+
w = (1.5 - p[x])
|
597
|
+
w *= w
|
598
|
+
a_target += w * a[x]
|
599
|
+
i_target += w * i[x]
|
600
|
+
weight += w
|
601
|
+
|
602
|
+
if len(indices) > 1:
|
603
|
+
a_target /= weight
|
604
|
+
i_target /= weight
|
605
|
+
for x in indices:
|
606
|
+
self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
|
607
|
+
|
572
608
|
else:
|
573
609
|
# RMS
|
574
610
|
p = [
|
@@ -588,28 +624,30 @@ class QrackAceBackend:
|
|
588
624
|
else:
|
589
625
|
self.sim[hq[q][0]].x(hq[q][1])
|
590
626
|
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
627
|
+
if not skip_rotation:
|
628
|
+
p, a, i = [0, 0, 0], [0, 0, 0], [0, 0, 0]
|
629
|
+
p[0], a[0], i[0] = self._get_bloch_angles(hq[0])
|
630
|
+
p[1], a[1], i[1] = self._get_bloch_angles(hq[1])
|
631
|
+
|
632
|
+
indices = []
|
633
|
+
a_target = 0
|
634
|
+
i_target = 0
|
635
|
+
weight = 0
|
636
|
+
for x in range(3):
|
637
|
+
if p[x] < 0.5:
|
638
|
+
continue
|
639
|
+
indices.append(x)
|
640
|
+
w = (1.5 - p[x])
|
641
|
+
w *= w
|
642
|
+
a_target += w * a[x]
|
643
|
+
i_target += w * i[x]
|
644
|
+
weight += w
|
645
|
+
|
646
|
+
if len(indices) > 1:
|
647
|
+
a_target /= weight
|
648
|
+
i_target /= weight
|
649
|
+
for x in indices:
|
650
|
+
self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
|
613
651
|
|
614
652
|
if phase:
|
615
653
|
for q in qb:
|
@@ -634,8 +672,8 @@ class QrackAceBackend:
|
|
634
672
|
b = hq[lhv]
|
635
673
|
b.u(th, ph, lm)
|
636
674
|
|
637
|
-
self._correct(lq, False)
|
638
|
-
self._correct(lq, True)
|
675
|
+
self._correct(lq, False, True)
|
676
|
+
self._correct(lq, True, False)
|
639
677
|
|
640
678
|
def r(self, p, th, lq):
|
641
679
|
hq = self._unpack(lq)
|
@@ -659,7 +697,7 @@ class QrackAceBackend:
|
|
659
697
|
b.rz(th)
|
660
698
|
|
661
699
|
if p != Pauli.PauliZ:
|
662
|
-
self._correct(lq, False)
|
700
|
+
self._correct(lq, False, p != Pauli.PauliX)
|
663
701
|
if p != Pauli.PauliX:
|
664
702
|
self._correct(lq, True)
|
665
703
|
|
@@ -883,7 +921,7 @@ class QrackAceBackend:
|
|
883
921
|
|
884
922
|
self._correct(lq1, True)
|
885
923
|
if pauli != Pauli.PauliZ:
|
886
|
-
self._correct(lq2, False)
|
924
|
+
self._correct(lq2, False, pauli != Pauli.PauliX)
|
887
925
|
if pauli != Pauli.PauliX:
|
888
926
|
self._correct(lq2, True)
|
889
927
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|