Problem
The qubit mapping engine requires dense N⁴ two-body integral tensors regardless of the underlying HamiltonianContainer type. QdkQubitMapper._run_impl() calls hamiltonian.get_two_body_integrals(), which forces full dense materialization even for containers designed to avoid it:
• CholeskyHamiltonianContainer builds and caches a dense four-center tensor from its Cholesky vectors
• SparseHamiltonianContainer materializes a dense N⁴ vector from its sparse storage
This means the mapper cannot exploit integral sparsity or low Cholesky rank, both in memory (O(N⁴) materialization) and in compute (iterating over zeros).
Proposed Solution
Add specialized encoding paths that consume integrals in their native storage format:
• Dense (canonical four-center): use the existing O(N⁴) loop — no change needed
• Cholesky-decomposed: iterate over Cholesky vectors L^K_{pq} and accumulate Σ_K L^K_{pq} L^K_{rs} contributions directly, avoiding dense tensor construction. This reduces the two-body loop from O(N⁴) to O(N² · N_chol) where N_chol is the Cholesky rank (typically O(N))
• Sparse (lattice/model): iterate over nonzero entries only, skipping the vast majority of the tensor for systems with local interactions
This would require either an integral-provider/iterator interface or container-type dispatch in the engine, so that each HamiltonianContainer variant can feed integrals in its natural form.
Problem
The qubit mapping engine requires dense N⁴ two-body integral tensors regardless of the underlying HamiltonianContainer type. QdkQubitMapper._run_impl() calls hamiltonian.get_two_body_integrals(), which forces full dense materialization even for containers designed to avoid it:
• CholeskyHamiltonianContainer builds and caches a dense four-center tensor from its Cholesky vectors
• SparseHamiltonianContainer materializes a dense N⁴ vector from its sparse storage
This means the mapper cannot exploit integral sparsity or low Cholesky rank, both in memory (O(N⁴) materialization) and in compute (iterating over zeros).
Proposed Solution
Add specialized encoding paths that consume integrals in their native storage format:
• Dense (canonical four-center): use the existing O(N⁴) loop — no change needed
• Cholesky-decomposed: iterate over Cholesky vectors L^K_{pq} and accumulate Σ_K L^K_{pq} L^K_{rs} contributions directly, avoiding dense tensor construction. This reduces the two-body loop from O(N⁴) to O(N² · N_chol) where N_chol is the Cholesky rank (typically O(N))
• Sparse (lattice/model): iterate over nonzero entries only, skipping the vast majority of the tensor for systems with local interactions
This would require either an integral-provider/iterator interface or container-type dispatch in the engine, so that each HamiltonianContainer variant can feed integrals in its natural form.