pyqrack-cuda 1.58.7__tar.gz → 1.58.9__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.7/pyqrack_cuda.egg-info → pyqrack_cuda-1.58.9}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_ace_backend.py +46 -17
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/setup.py +1 -1
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/LICENSE +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/Makefile +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/README.md +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyproject.toml +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.58.7 → pyqrack_cuda-1.58.9}/setup.cfg +0 -0
@@ -443,6 +443,20 @@ 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
|
+
|
446
460
|
def get_bloch_angles(self, hq):
|
447
461
|
sim = self.sim[hq[0]]
|
448
462
|
q = hq[1]
|
@@ -471,6 +485,24 @@ class QrackAceBackend:
|
|
471
485
|
|
472
486
|
return prob, azimuth, inclination
|
473
487
|
|
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
|
+
|
474
506
|
def rotate_to_bloch(
|
475
507
|
self, hq, azimuth_curr, inclination_curr, azimuth_target, inclination_target
|
476
508
|
):
|
@@ -493,17 +525,6 @@ class QrackAceBackend:
|
|
493
525
|
|
494
526
|
sim.mtrx([m00, m01, m10, m11], q)
|
495
527
|
|
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
529
|
def _correct(self, lq, phase=False):
|
509
530
|
hq = self._unpack(lq)
|
@@ -559,6 +580,7 @@ class QrackAceBackend:
|
|
559
580
|
p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
|
560
581
|
p[0], a[0], i[0] = self.get_bloch_angles(hq[0])
|
561
582
|
p[1], a[1], i[1] = self.get_bloch_angles(hq[1])
|
583
|
+
p[2], a[2], i[2] = self.get_lhv_bloch_angles(hq[2])
|
562
584
|
p[3], a[3], i[3] = self.get_bloch_angles(hq[3])
|
563
585
|
p[4], a[4], i[4] = self.get_bloch_angles(hq[4])
|
564
586
|
|
@@ -570,7 +592,7 @@ class QrackAceBackend:
|
|
570
592
|
if p[x] < 0.5:
|
571
593
|
continue
|
572
594
|
indices.append(x)
|
573
|
-
w =
|
595
|
+
w = (1.5 - p[x])
|
574
596
|
a_target += w * a[x]
|
575
597
|
i_target += w * i[x]
|
576
598
|
weight += w
|
@@ -579,7 +601,10 @@ class QrackAceBackend:
|
|
579
601
|
a_target /= weight
|
580
602
|
i_target /= weight
|
581
603
|
for x in indices:
|
582
|
-
|
604
|
+
if x == 2:
|
605
|
+
self.rotate_lhv_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
606
|
+
else:
|
607
|
+
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
583
608
|
else:
|
584
609
|
# RMS
|
585
610
|
p = [
|
@@ -599,9 +624,10 @@ class QrackAceBackend:
|
|
599
624
|
else:
|
600
625
|
self.sim[hq[q][0]].x(hq[q][1])
|
601
626
|
|
602
|
-
p, a, i = [0, 0], [0, 0], [0, 0]
|
627
|
+
p, a, i = [0, 0, 0], [0, 0, 0], [0, 0, 0]
|
603
628
|
p[0], a[0], i[0] = self.get_bloch_angles(hq[0])
|
604
629
|
p[1], a[1], i[1] = self.get_bloch_angles(hq[1])
|
630
|
+
p[2], a[2], i[2] = self.get_lhv_bloch_angles(hq[2])
|
605
631
|
|
606
632
|
indices = []
|
607
633
|
a_target = 0
|
@@ -611,8 +637,8 @@ class QrackAceBackend:
|
|
611
637
|
if p[x] < 0.5:
|
612
638
|
continue
|
613
639
|
indices.append(x)
|
614
|
-
w =
|
615
|
-
a_target +=
|
640
|
+
w = (1.5 - p[x])
|
641
|
+
a_target += w * a[x]
|
616
642
|
i_target += w * i[x]
|
617
643
|
weight += w
|
618
644
|
|
@@ -620,7 +646,10 @@ class QrackAceBackend:
|
|
620
646
|
a_target /= weight
|
621
647
|
i_target /= weight
|
622
648
|
for x in indices:
|
623
|
-
|
649
|
+
if x == 2:
|
650
|
+
self.rotate_lhv_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
651
|
+
else:
|
652
|
+
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
624
653
|
|
625
654
|
if phase:
|
626
655
|
for q in qb:
|
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
|