Computes the sum over an array of values.