pyqrack 1.60.0__tar.gz → 1.61.1__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.
Potentially problematic release.
This version of pyqrack might be problematic. Click here for more details.
- {pyqrack-1.60.0/pyqrack.egg-info → pyqrack-1.61.1}/PKG-INFO +1 -1
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_ace_backend.py +34 -50
- {pyqrack-1.60.0 → pyqrack-1.61.1/pyqrack.egg-info}/PKG-INFO +1 -1
- {pyqrack-1.60.0 → pyqrack-1.61.1}/setup.py +1 -1
- {pyqrack-1.60.0 → pyqrack-1.61.1}/LICENSE +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/MANIFEST.in +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/Makefile +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/README.md +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyproject.toml +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/__init__.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/pauli.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/stats/__init__.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack.egg-info/SOURCES.txt +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack.egg-info/dependency_links.txt +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack.egg-info/not-zip-safe +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack.egg-info/requires.txt +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/pyqrack.egg-info/top_level.txt +0 -0
- {pyqrack-1.60.0 → pyqrack-1.61.1}/setup.cfg +0 -0
|
@@ -332,7 +332,8 @@ class QrackAceBackend:
|
|
|
332
332
|
|
|
333
333
|
# You can still "monkey-patch" this, after the constructor.
|
|
334
334
|
if "QRACK_QUNIT_SEPARABILITY_THRESHOLD" not in os.environ:
|
|
335
|
-
|
|
335
|
+
# (1 - 1 / sqrt(2)) / 4 (but empirically tuned)
|
|
336
|
+
self.sim[i].set_sdrp(0.073223304703363119)
|
|
336
337
|
|
|
337
338
|
def clone(self):
|
|
338
339
|
return QrackAceBackend(toClone=self)
|
|
@@ -442,49 +443,42 @@ class QrackAceBackend:
|
|
|
442
443
|
def _get_lhv_bloch_angles(self, sim):
|
|
443
444
|
# Z axis
|
|
444
445
|
z = 1 - 2 * sim.prob(Pauli.PauliZ)
|
|
445
|
-
prob = z**2
|
|
446
446
|
|
|
447
447
|
# X axis
|
|
448
448
|
x = 1 - 2 * sim.prob(Pauli.PauliX)
|
|
449
|
-
prob += x**2
|
|
450
449
|
|
|
451
450
|
# Y axis
|
|
452
451
|
y = 1 - 2 * sim.prob(Pauli.PauliY)
|
|
453
|
-
prob += y**2
|
|
454
452
|
|
|
455
|
-
prob = math.sqrt(prob)
|
|
456
453
|
inclination = math.atan2(math.sqrt(x**2 + y**2), z)
|
|
457
454
|
azimuth = math.atan2(y, x)
|
|
458
455
|
|
|
459
|
-
return
|
|
456
|
+
return azimuth, inclination
|
|
460
457
|
|
|
461
458
|
def _get_bloch_angles(self, hq):
|
|
462
|
-
sim = self.sim[hq[0]]
|
|
459
|
+
sim = self.sim[hq[0]].clone()
|
|
463
460
|
q = hq[1]
|
|
461
|
+
sim.separate([q])
|
|
464
462
|
|
|
465
463
|
# Z axis
|
|
466
464
|
z = 1 - 2 * sim.prob(q)
|
|
467
|
-
prob = z**2
|
|
468
465
|
|
|
469
466
|
# X axis
|
|
470
467
|
sim.h(q)
|
|
471
468
|
x = 1 - 2 * sim.prob(q)
|
|
472
|
-
prob += x**2
|
|
473
469
|
sim.h(q)
|
|
474
470
|
|
|
475
471
|
# Y axis
|
|
476
472
|
sim.adjs(q)
|
|
477
473
|
sim.h(q)
|
|
478
474
|
y = 1 - 2 * sim.prob(q)
|
|
479
|
-
prob += y**2
|
|
480
475
|
sim.h(q)
|
|
481
476
|
sim.s(q)
|
|
482
477
|
|
|
483
|
-
prob = math.sqrt(prob)
|
|
484
478
|
inclination = math.atan2(math.sqrt(x**2 + y**2), z)
|
|
485
479
|
azimuth = math.atan2(y, x)
|
|
486
480
|
|
|
487
|
-
return
|
|
481
|
+
return azimuth, inclination
|
|
488
482
|
|
|
489
483
|
def _rotate_to_bloch(
|
|
490
484
|
self, hq, delta_azimuth, delta_inclination
|
|
@@ -575,30 +569,25 @@ class QrackAceBackend:
|
|
|
575
569
|
self.sim[hq[q][0]].x(hq[q][1])
|
|
576
570
|
|
|
577
571
|
if not skip_rotation:
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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])
|
|
583
578
|
|
|
584
|
-
indices = []
|
|
585
579
|
a_target = 0
|
|
586
580
|
i_target = 0
|
|
587
|
-
weight = 0
|
|
588
581
|
for x in range(5):
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
if len(indices) > 1:
|
|
599
|
-
a_target /= weight
|
|
600
|
-
i_target /= weight
|
|
601
|
-
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:
|
|
602
591
|
self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
|
|
603
592
|
|
|
604
593
|
else:
|
|
@@ -621,28 +610,23 @@ class QrackAceBackend:
|
|
|
621
610
|
self.sim[hq[q][0]].x(hq[q][1])
|
|
622
611
|
|
|
623
612
|
if not skip_rotation:
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
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])
|
|
627
617
|
|
|
628
|
-
indices = []
|
|
629
618
|
a_target = 0
|
|
630
619
|
i_target = 0
|
|
631
|
-
weight = 0
|
|
632
620
|
for x in range(3):
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
if len(indices) > 1:
|
|
643
|
-
a_target /= weight
|
|
644
|
-
i_target /= weight
|
|
645
|
-
for x in indices:
|
|
621
|
+
a_target += a[x]
|
|
622
|
+
i_target += i[x]
|
|
623
|
+
|
|
624
|
+
a_target /= 5
|
|
625
|
+
i_target /= 5
|
|
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:
|
|
646
630
|
self._rotate_to_bloch(hq[x], a_target - a[x], i_target - i[x])
|
|
647
631
|
|
|
648
632
|
if phase:
|
|
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
|