Example codes: exact diagonalization
Please look at the readme page if you have not done so already. Here we present an implementation of exact diagonalization for a quantum many-body Hamiltonian composed of a sum of local terms. This code formats the quantum problem in such a way that it can be passed as an input to a standard sparse eigensolver, which then performs the exact diagonalization based on the Lanczos algorithm. Important, however, is that we never form the full Hamiltonian H as a matrix; instead the Hamiltonian is represented as a function that acts on an input state |ψ> in order to output H|ψ>. If we have a lattice of N sites of local dimension d, then the memory required using this approach scales as O(d^N), i.e. the memory required to represent a state |ψ>, as opposed to scaling as O(d^(2N)), which would otherwise be required to represent H as a matrix. This implementation can comfortably handle chains of N = 25 or more spin-1/2 sites when run on standard desktop / laptop PC's.
-
Scaling of memory: O(d^N)
-
Implemented for a finite chain with open or periodic boundaries
​
-
Uses the Lanczos algorithm built into the standard 'eigs' function
Wavefunction:
Local Hamiltonian:
Index ordering conventions:
Hamiltonian as a function (Julia function)
Initialization (Julia script)
'mainExactDiag' benchmark:
​
Method: Exact diagonalization (Lanczos method)
Test problem: 1D quantum XX model (on lattice of N = 18 sites with periodic boundaries)
Running time: approx 10 secs
Quantities computed: ground energy
​
Typical results:
​
Ground energy (exact diag): -23.035081932574503
Ground energy (analytic): -23.035081932574535