fixes for momentum update and energy
switch to HMC sampler in training code
sparse matrix fixes