pyqrack-cuda 1.58.5__tar.gz → 1.58.7__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.5/pyqrack_cuda.egg-info → pyqrack_cuda-1.58.7}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_ace_backend.py +29 -43
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/setup.py +1 -1
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/LICENSE +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/Makefile +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/README.md +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyproject.toml +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/__init__.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.58.5 → pyqrack_cuda-1.58.7}/setup.cfg +0 -0
@@ -443,20 +443,6 @@ 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
|
-
|
460
446
|
def get_bloch_angles(self, hq):
|
461
447
|
sim = self.sim[hq[0]]
|
462
448
|
q = hq[1]
|
@@ -485,24 +471,6 @@ class QrackAceBackend:
|
|
485
471
|
|
486
472
|
return prob, azimuth, inclination
|
487
473
|
|
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
|
-
|
506
474
|
def rotate_to_bloch(
|
507
475
|
self, hq, azimuth_curr, inclination_curr, azimuth_target, inclination_target
|
508
476
|
):
|
@@ -525,6 +493,18 @@ class QrackAceBackend:
|
|
525
493
|
|
526
494
|
sim.mtrx([m00, m01, m10, m11], q)
|
527
495
|
|
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
|
def _correct(self, lq, phase=False):
|
529
509
|
hq = self._unpack(lq)
|
530
510
|
|
@@ -579,22 +559,25 @@ class QrackAceBackend:
|
|
579
559
|
p, a, i = [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]
|
580
560
|
p[0], a[0], i[0] = self.get_bloch_angles(hq[0])
|
581
561
|
p[1], a[1], i[1] = self.get_bloch_angles(hq[1])
|
582
|
-
p[3], a[
|
583
|
-
p[4], a[
|
562
|
+
p[3], a[3], i[3] = self.get_bloch_angles(hq[3])
|
563
|
+
p[4], a[4], i[4] = self.get_bloch_angles(hq[4])
|
584
564
|
|
585
565
|
indices = []
|
586
566
|
a_target = 0
|
587
567
|
i_target = 0
|
588
|
-
|
568
|
+
weight = 0
|
569
|
+
for x in range(5):
|
589
570
|
if p[x] < 0.5:
|
590
571
|
continue
|
591
572
|
indices.append(x)
|
592
|
-
|
593
|
-
|
573
|
+
w = self.logit(1 - p[x])
|
574
|
+
a_target += w * a[x]
|
575
|
+
i_target += w * i[x]
|
576
|
+
weight += w
|
594
577
|
|
595
578
|
if len(indices) > 1:
|
596
|
-
a_target /=
|
597
|
-
i_target /=
|
579
|
+
a_target /= weight
|
580
|
+
i_target /= weight
|
598
581
|
for x in indices:
|
599
582
|
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
600
583
|
else:
|
@@ -623,16 +606,19 @@ class QrackAceBackend:
|
|
623
606
|
indices = []
|
624
607
|
a_target = 0
|
625
608
|
i_target = 0
|
609
|
+
weight = 0
|
626
610
|
for x in range(2):
|
627
611
|
if p[x] < 0.5:
|
628
612
|
continue
|
629
613
|
indices.append(x)
|
630
|
-
|
631
|
-
|
614
|
+
w = self.logit(1.0 - p[x])
|
615
|
+
a_target += x * a[x]
|
616
|
+
i_target += w * i[x]
|
617
|
+
weight += w
|
632
618
|
|
633
619
|
if len(indices) > 1:
|
634
|
-
a_target /=
|
635
|
-
i_target /=
|
620
|
+
a_target /= weight
|
621
|
+
i_target /= weight
|
636
622
|
for x in indices:
|
637
623
|
self.rotate_to_bloch(hq[x], a[x], i[x], a_target, i_target)
|
638
624
|
|
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
|