The QC framework implements topological Hilbert space compression using Matrix Product States (MPS) with vacuum-core architecture. This enables quantum simulation beyond 20 qubits by reducing exponential memory requirements to polynomial scaling.
Topological features are implemented in topological_hilbert_compression2.py (995 lines) and integrate with the neural quantum backends.
An n-qubit quantum state can be represented as:∣ψ⟩=i1,i2,...,in∑Ai1[1]Ai2[2]⋯Ain[n]∣i1i2⋯in⟩Where each A^[k] is a rank-3 tensor with shape (χₖ₋₁, 2, χₖ), and χ is the bond dimension.
MPS exploits the area law of entanglement:For many physical states (ground states, thermal states, time-evolved states with local interactions), entanglement entropy scales with boundary area, not volume:S(cut)∼O(logn)orO(1)Not:S(cut)∼O(n)(volume law)States satisfying area law can be efficiently represented with small bond dimension χ.Examples:
Geometric phase acquired during adiabatic evolution:
class TopologicalProtector: def compute_berry_phase(self, state: ITensorNetwork, qubit_a: int, qubit_b: int) -> float: """Calculate Berry phase between two qubits.""" probs = state.probabilities() dim = len(probs) bit_a = state.n_qubits - 1 - qubit_a bit_b = state.n_qubits - 1 - qubit_b phase = 0.0 for k in range(dim): if ((k >> bit_a) & 1) != ((k >> bit_b) & 1): phase += probs[k].item() * math.pi return phase
From topological_hilbert_compression2.py:433-442
Physical Meaning
Winding number: Counts how many times the quantum state “wraps around” in parameter space. Non-zero winding → topologically non-trivial.Berry phase: Acquired when parameters change adiabatically in a closed loop. Related to geometric properties of Hilbert space, independent of evolution speed.Protection: States with non-zero topological invariants resist local perturbations. Small errors cannot destroy topological properties.
The framework classifies quantum states by their topological properties:
class HilbertPhase(Enum): HOT_GLASS = auto() # High entropy, large bond dim COLD_GLASS = auto() # Medium entropy, medium bond dim POLYCRYSTAL = auto() # Low entropy, small bond dim TOPOLOGICAL_INSULATOR = auto() # Protected, sparse vacuum PERFECT_CRYSTAL = auto() # Zero entropy, χ=1
def left_canonicalize(self) -> torch.Tensor: """Put MPS core in left canonical form. Result: A†A = I (isometry from left) Returns: S·V† to propagate to right """ shape = self.chi_left * self.d, self.chi_right tensor_matrix = self.tensor.reshape(shape) u, s, vh = torch.linalg.svd(tensor_matrix, full_matrices=False) self._tensor = u.reshape(self.chi_left, self.d, -1) return s @ vh # Propagate singular values right
From topological_hilbert_compression2.py:147-152
Right Canonical
def right_canonicalize(self) -> torch.Tensor: """Put MPS core in right canonical form. Result: AA† = I (isometry from right) Returns: U·S to propagate to left """ shape = self.chi_left, self.d * self.chi_right tensor_matrix = self.tensor.reshape(shape) u, s, vh = torch.linalg.svd(tensor_matrix, full_matrices=False) self._tensor = vh.reshape(-1, self.d, self.chi_right) return u @ s # Propagate singular values left
SVD truncation introduces approximation error. Monitor bond dimension growth - if χ → max_bond_dimension consistently, increase the limit or switch to direct backend.
The framework automatically selects the optimal backend:
def _select_backend(self, n_qubits: int, force_mps: bool = False) -> HybridBackend: """Route to best backend for given system size.""" if force_mps or self.config.force_mps: if self.mps_backend.can_handle(n_qubits): return self.mps_backend raise ValueError(f"MPS cannot handle {n_qubits} qubits") # Auto-routing if self.direct_backend.can_handle(n_qubits): return self.direct_backend # Exact for n ≤ 20 elif self.mps_backend.can_handle(n_qubits): return self.mps_backend # Approximate for 20 < n ≤ 40 else: raise ValueError(f"No backend available for {n_qubits} qubits")
from topological_hilbert_compression2 import Schrodinger20Experimentexperiment = Schrodinger20Experiment(config)# Run full test suiteresults = experiment.run_all()# Or specific benchmarkscaling = experiment.run_scaling_benchmark(max_qubits=50, use_mps=True)import matplotlib.pyplot as pltplt.plot(scaling['qubits'], np.log10(scaling['compression_ratio']))plt.xlabel('Number of Qubits')plt.ylabel('log₁₀(Compression Ratio)')plt.title('MPS Compression Scaling')plt.show()
Vidal, G. (2003). “Efficient Classical Simulation of Slightly Entangled Quantum Computations”
Schollwöck, U. (2011). “The density-matrix renormalization group in the age of matrix product states”
For quantum chemistry applications, MPS backend automatically activates for molecules with >20 qubits. The compression is lossless for low-entanglement states like molecular ground states.