Simplify implementation of centralize_sumabs2

This is not only a bit shorter but also a bit faster, likely due to the partially unrolled summation.

Also fix a bounds violation when computing the variance of a vector with a single element.

cc @lindahua