pyqrack-complex128 2.30.2__tar.gz → 2.30.3__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_complex128-2.30.2/pyqrack_complex128.egg-info → pyqrack_complex128-2.30.3}/PKG-INFO +1 -1
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_bridge.py +29 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3/pyqrack_complex128.egg-info}/PKG-INFO +1 -1
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/setup.py +1 -1
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/LICENSE +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/MANIFEST.in +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/Makefile +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/README.md +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyproject.toml +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/__init__.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/pauli.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_ace_backend.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_ace_mps_backend.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_near_clifford_qec_backend.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_neuron_torch_layer.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_simulator.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_stabilizer.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_system/qrack_system.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/SOURCES.txt +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/dependency_links.txt +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/not-zip-safe +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/requires.txt +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/top_level.txt +0 -0
- {pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/setup.cfg +0 -0
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
#
|
|
67
67
|
# fidelity_estimate multiplies the kept Schmidt weight (greedy) or sum_g p_g^2 (born) per truncation.
|
|
68
68
|
|
|
69
|
+
import contextlib
|
|
69
70
|
import ctypes
|
|
70
71
|
import math
|
|
71
72
|
|
|
@@ -139,6 +140,7 @@ class QrackBridge:
|
|
|
139
140
|
self.bond = list(src.bond)
|
|
140
141
|
self.sim = [s.clone() for s in src.sim]
|
|
141
142
|
self._touched = set(src._touched)
|
|
143
|
+
self._deferring = 0
|
|
142
144
|
self.rng = np.random.default_rng(int(src.rng.integers(1 << 62)))
|
|
143
145
|
return
|
|
144
146
|
if truncation not in ("greedy", "born"):
|
|
@@ -163,6 +165,7 @@ class QrackBridge:
|
|
|
163
165
|
self.lazy_bonds = lazy_bonds
|
|
164
166
|
self.max_patch_qubits = max_patch_qubits
|
|
165
167
|
self.flushes = 0
|
|
168
|
+
self._deferring = 0
|
|
166
169
|
self.truncation = truncation
|
|
167
170
|
self.fidelity_estimate = 1.0
|
|
168
171
|
self.truncations = 0
|
|
@@ -445,6 +448,11 @@ class QrackBridge:
|
|
|
445
448
|
return False
|
|
446
449
|
|
|
447
450
|
def _maybe_compress(self):
|
|
451
|
+
if self._deferring:
|
|
452
|
+
# Inside deferred(): keep only the exact rank (drop zero singular values); never truncate.
|
|
453
|
+
if not self.lazy_bonds or self._over_budget():
|
|
454
|
+
self._compress(exact_only=True)
|
|
455
|
+
return
|
|
448
456
|
if not self.lazy_bonds:
|
|
449
457
|
self._compress() # eager: one sweep per bridged gate
|
|
450
458
|
return
|
|
@@ -453,6 +461,27 @@ class QrackBridge:
|
|
|
453
461
|
if self._over_budget():
|
|
454
462
|
self._compress()
|
|
455
463
|
|
|
464
|
+
@contextlib.contextmanager
|
|
465
|
+
def deferred(self):
|
|
466
|
+
"""Truncate once, after the whole block, never inside it:
|
|
467
|
+
|
|
468
|
+
with sim.deferred():
|
|
469
|
+
for i in range(9):
|
|
470
|
+
sim.mcx([b[i]], a[i]) # e.g. a transversal logical CNOT
|
|
471
|
+
|
|
472
|
+
Inside, bridged gates are recompressed only exactly, so bonds carry the full transient
|
|
473
|
+
entanglement of the block; on exit one sweep truncates to max_bonds. Use it around any
|
|
474
|
+
multi-gate operation whose intermediate states are more entangled than its result
|
|
475
|
+
(transversal logical gates, decode/encode, gate decompositions). Heap grows with the
|
|
476
|
+
transient rank inside the block. Nests; only the outermost exit truncates."""
|
|
477
|
+
self._deferring += 1
|
|
478
|
+
try:
|
|
479
|
+
yield self
|
|
480
|
+
finally:
|
|
481
|
+
self._deferring -= 1
|
|
482
|
+
if not self._deferring:
|
|
483
|
+
self._maybe_compress()
|
|
484
|
+
|
|
456
485
|
def flush(self):
|
|
457
486
|
"""Truncate any buffered bonds back to max_bonds now (readout does this automatically)."""
|
|
458
487
|
self._compress()
|
|
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
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_near_clifford_qec_backend.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/qrack_system/qrack_system.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack/stats/load_quantized_data.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/requires.txt
RENAMED
|
File without changes
|
{pyqrack_complex128-2.30.2 → pyqrack_complex128-2.30.3}/pyqrack_complex128.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|