Esempio n. 1
0
        /// <summary>
        /// Evaluates the geometric mean.
        /// Returns NaN if data is empty or if any entry is NaN.
        /// </summary>
        /// <param name="data">The data to calculate the geometric mean of.</param>
        /// <returns>The geometric mean of the sample.</returns>
        public static double GeometricMean(this IEnumerable <double> data)
        {
            var array = data as double[];

            return(array != null
                ? ArrayStatistics.GeometricMean(array)
                : StreamingStatistics.GeometricMean(data));
        }