Modifying smooth_logsumexp.m to allow scaling and to be numerically
stable against over-flow errors.