Efficient calculation of matrix elements in low storage filter diagonalization