Example #1
0
        static double[] Rank(IEnumerable <double> series)
        {
            if (series == null)
            {
                return(new double[0]);
            }
            // WARNING: do not try to cast series to an array and use it directly,
            // as we need to sort it (inplace operation)
            var data = series.ToArray();

            return(ArrayStatistics.RanksInplace(data, RankDefinition.Average));
        }