Comments.
Using std::transform to normalize the vector of weights.