We take the Bose–Hubbard model to illustrate exact diagonalization techniques in a pedagogical way. We follow the route of first generating all the basis vectors, then setting up the Hamiltonian matrix with respect to this basis and finally using the Lanczos algorithm to solve low lying eigenstates and eigenvalues. Emphasis is placed on how to enumerate all the basis vectors and how to use the hashing trick to set up the Hamiltonian matrix or matrices corresponding to other quantities. Although… CONTINUE READING