Caching the mean of a vector