The Hamiltonian is then stored as an N_{SD} \times N_{SD} array of real numbers, which can be allocated once you have created the many-body basis and know N_{SD} .