Compute the mean over an array of values.