/// <summary> /// Returns the maximum value in the sample data. /// Returns NaN if data is empty or if any entry is NaN. /// </summary> /// <param name="data">The sample data.</param> /// <returns>The maximum value in the sample data.</returns> public static double Maximum(this IEnumerable <double> data) { var array = data as double[]; return(array != null ? ArrayStatistics.Maximum(array) : StreamingStatistics.Maximum(data)); }