In this chapter I describe the essence of the main theoretical tool we use to evaluate the partition function and its derivatives which we express as cumulants, mapping the underlying Hamiltonian onto a matrix. It all revolves around the Lanczos algorithm, an iterative procedure to find eigenvalues and eigenvectors of large matrices.