pyqrack-cuda 1.58.9__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.9/pyqrack_cuda.egg-info → pyqrack_cuda-1.58.10}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_ace_backend.py +76 -78
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/setup.py +1 -1
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/LICENSE +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/Makefile +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/README.md +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyproject.toml +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.58.9 → pyqrack_cuda-1.58.10}/setup.cfg +0 -0
@@ -443,12 +443,17 @@ class QrackAceBackend:
|
|
443
443
|
|
444
444
|
return qb, lhv
|
445
445
|
|
446
|
-
def
|
447
|
-
|
446
|
+
def _get_lhv_bloch_angles(self, sim):
|
447
|
+
# Z axis
|
448
|
+
z = 1 - 2 * sim.prob(Pauli.PauliZ)
|
448
449
|
prob = z**2
|
449
|
-
|
450
|
+
|
451
|
+
# X axis
|
452
|
+
x = 1 - 2 * sim.prob(Pauli.PauliX)
|
450
453
|
prob += x**2
|
451
|
-
|
454
|
+
|
455
|
+
# Y axis
|
456
|
+
y = 1 - 2 * sim.prob(Pauli.PauliY)
|
452
457
|
prob += y**2
|
453
458
|
|
454
459
|
prob = math.sqrt(prob)
|
@@ -457,7 +462,7 @@ class QrackAceBackend:
|
|
457
462
|
|
458
463
|
return prob, azimuth, inclination
|
459
464
|
|
460
|
-
def
|
465
|
+
def _get_bloch_angles(self, hq):
|
461
466
|
sim = self.sim[hq[0]]
|
462
467
|
q = hq[1]
|
463
468
|
|
@@ -485,12 +490,13 @@ class QrackAceBackend:
|
|
485
490
|
|
486
491
|
return prob, azimuth, inclination
|
487
492
|
|
488
|
-
def
|
489
|
-
self,
|
493
|
+
def _rotate_to_bloch(
|
494
|
+
self, hq, delta_azimuth, delta_inclination
|
490
495
|
):
|
491
|
-
|
492
|
-
|
496
|
+
sim = self.sim[hq[0]]
|
497
|
+
q = hq[1]
|
493
498
|
|
499
|
+
# Apply rotation as "Azimuth, Inclination" (AI)
|
494
500
|
cosA = math.cos(delta_azimuth)
|
495
501
|
sinA = math.sin(delta_azimuth)
|
496
502
|
cosI = math.cos(delta_inclination / 2)
|
@@ -501,17 +507,12 @@ class QrackAceBackend:
|
|
501
507
|
m10 = complex(cosA, sinA) * sinI
|
502
508
|
m11 = complex(cosI, 0)
|
503
509
|
|
504
|
-
|
505
|
-
|
506
|
-
def rotate_to_bloch(
|
507
|
-
self, hq, azimuth_curr, inclination_curr, azimuth_target, inclination_target
|
508
|
-
):
|
509
|
-
sim = self.sim[hq[0]]
|
510
|
-
q = hq[1]
|
510
|
+
sim.mtrx([m00, m01, m10, m11], q)
|
511
511
|
|
512
|
-
delta_azimuth = azimuth_target - azimuth_curr
|
513
|
-
delta_inclination = inclination_target - inclination_curr
|
514
512
|
|
513
|
+
def _rotate_lhv_to_bloch(
|
514
|
+
self, sim, delta_azimuth, delta_inclination
|
515
|
+
):
|
515
516
|
# Apply rotation as "Azimuth, Inclination" (AI)
|
516
517
|
cosA = math.cos(delta_azimuth)
|
517
518
|
sinA = math.sin(delta_azimuth)
|
@@ -523,10 +524,10 @@ class QrackAceBackend:
|
|
523
524
|
m10 = complex(cosA, sinA) * sinI
|
524
525
|
m11 = complex(cosI, 0)
|
525
526
|
|
526
|
-
sim.mtrx([m00, m01, m10, m11]
|
527
|
+
sim.mtrx([m00, m01, m10, m11])
|
527
528
|
|
528
529
|
|
529
|
-
def _correct(self, lq, phase=False):
|
530
|
+
def _correct(self, lq, phase=False, skip_rotation=False):
|
530
531
|
hq = self._unpack(lq)
|
531
532
|
|
532
533
|
if len(hq) == 1:
|
@@ -577,34 +578,33 @@ class QrackAceBackend:
|
|
577
578
|
else:
|
578
579
|
self.sim[hq[q][0]].x(hq[q][1])
|
579
580
|
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
self.
|
606
|
-
|
607
|
-
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
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
|
+
|
608
608
|
else:
|
609
609
|
# RMS
|
610
610
|
p = [
|
@@ -624,32 +624,30 @@ class QrackAceBackend:
|
|
624
624
|
else:
|
625
625
|
self.sim[hq[q][0]].x(hq[q][1])
|
626
626
|
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
self.
|
651
|
-
else:
|
652
|
-
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
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])
|
653
651
|
|
654
652
|
if phase:
|
655
653
|
for q in qb:
|
@@ -674,8 +672,8 @@ class QrackAceBackend:
|
|
674
672
|
b = hq[lhv]
|
675
673
|
b.u(th, ph, lm)
|
676
674
|
|
677
|
-
self._correct(lq, False)
|
678
|
-
self._correct(lq, True)
|
675
|
+
self._correct(lq, False, True)
|
676
|
+
self._correct(lq, True, False)
|
679
677
|
|
680
678
|
def r(self, p, th, lq):
|
681
679
|
hq = self._unpack(lq)
|
@@ -699,7 +697,7 @@ class QrackAceBackend:
|
|
699
697
|
b.rz(th)
|
700
698
|
|
701
699
|
if p != Pauli.PauliZ:
|
702
|
-
self._correct(lq, False)
|
700
|
+
self._correct(lq, False, p != Pauli.PauliX)
|
703
701
|
if p != Pauli.PauliX:
|
704
702
|
self._correct(lq, True)
|
705
703
|
|
@@ -923,7 +921,7 @@ class QrackAceBackend:
|
|
923
921
|
|
924
922
|
self._correct(lq1, True)
|
925
923
|
if pauli != Pauli.PauliZ:
|
926
|
-
self._correct(lq2, False)
|
924
|
+
self._correct(lq2, False, pauli != Pauli.PauliX)
|
927
925
|
if pauli != Pauli.PauliX:
|
928
926
|
self._correct(lq2, True)
|
929
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
|