Implicit matrix size optimization.
Better documentation on where the energy functions are from.