def energy(W, V, H):
 return (- (T.dot(V, W) * H).sum(axis=1))

def energy ( W , V , H ) : return ( - ( T . dot ( V , W ) * H ) . sum ( axis = 1 ) )
compute the total energy for the hamiltonian at a given position/momentum .