Sparse Many-Body Hamiltonians
A local Hamiltonian connects each occupation configuration to relatively few others. Sparse assembly exploits this connectivity, while matrix-free action avoids storing the matrix entirely. Both approaches depend on correct local transition rules and a consistent basis map.
Helpful background. Spin, fermion, and boson bases supply operator actions.
Local terms as transitions
Section titled “Local terms as transitions”Write . For each input basis state , apply each operator product from right to left. If it produces , accumulate
The input state labels the column. Accumulation matters because distinct terms can connect the same pair of states. A coordinate-format sparse constructor should sum duplicate entries before compression.
Diagonal terms can be computed directly from occupations. Off-diagonal terms should reuse tested ladder or spin actions. Discard only transitions forbidden by the model or outside a deliberately chosen basis; an unexpected transition outside a conserved sector is an error to investigate.
Sparse storage and matrix-free action
Section titled “Sparse storage and matrix-free action”Coordinate storage is convenient while appending transitions. Compressed sparse row storage is suited to repeated matrix-vector products; compressed sparse column storage can suit factorization workflows. Choose formats after defining the operation rather than repeatedly converting in the solver loop.
A matrix-free application uses the same transitions:
For basis states and local transitions per state, the action typically costs ; actual connectivity can be reduced by constraints or increased by long-range terms. Storage can be plus the basis and work vectors, but repeated decoding and index lookup may dominate runtime.
Parallel column-based action writes to overlapping output entries. Use thread-local accumulation, safe reduction, or a row-oriented scheme; unsynchronized writes can generate nondeterministic numerical errors.
A two-site hopping check
Section titled “A two-site hopping check”For one particle on two sites with onsite energies ,
Build it once from explicit operators and once from transitions. A complex hopping tests adjoints that real benchmarks miss. The eigenvalues are
Check that reversing a directed hopping uses the conjugate. If the input term list already contains both directions, automatically adding a Hermitian conjugate doubles the hopping.
Set , , and use units with the hopping magnitude as the energy unit. Then , and evolution for duration from gives . Accidentally assembling gives . At both implementations have identical site probabilities and eigenvalues, but is respectively and . A phase-sensitive observable therefore supplies a stronger assembly test than the spectrum and norm together.
For duplicate accumulation, split one hopping coefficient into two contributions whose sum is the intended , and add a pair of canceling diagonal terms. The assembled action must remain identical before and after this algebraic rewriting. This checks the summation semantics without depending on a particular sparse library.
Structural and action tests
Section titled “Structural and action tests”Test for a stored matrix. For matrix-free action, compare with for several independent complex vectors, and compare against a small explicit reference.
Check known conserved quantities via commutator action and compare diagonal traces where analytic counts are available. These tests do not establish every matrix element, so retain a small basis-by-basis comparison as well. A single matching ground-state energy is too weak to certify assembly.
Matrix entries can cancel exactly. Sum duplicates before deciding sparsity or dropping tiny values. An arbitrary magnitude threshold can remove small but physically relevant couplings and should be treated as an additional controlled approximation.
Exercise
Section titled “Exercise”Why can a Hamiltonian assembled with transposed row and column indices have the right eigenvalues and still produce wrong dynamics?
Solution
A matrix and its transpose have the same characteristic polynomial. For a Hermitian matrix with complex hopping, transposition complex-conjugates the physical phases and can reverse current-related observables. Testing complex-vector action or a flux-sensitive observable detects an error that a spectrum comparison misses.
References
Section titled “References”- SciPy developers, “Sparse arrays”, SciPy documentation — sparse formats, duplicate entries, and linear operators.
- Weinberg, P., and Bukov, M., “QuSpin. Part II: bosons, fermions and higher spins,” SciPost Physics 7, 020 (2019), arXiv:1804.06782.