Ignore:
Timestamp:
10/22/15 19:12:29 (4 years ago)
Author:
gkronber
Message:

#2491: removed usage of Percentile extension method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs

    r13034 r13051  
    6565
    6666    // Numerical Recipes in C++, §8.5 Selecting the Mth Largest, O(n)
    67     // Giben k in [0..n-1] returns an array value from array arr[0..n-1] such that k array values are
     67    // Given k in [0..n-1] returns an array value from array arr[0..n-1] such that k array values are
    6868    // lee than or equal to the one returned. The input array will be rearranged to hav this value in
    6969    // location arr[k], with all smaller elements moved to arr[0..k-1] (in arbitrary order) and all
    7070    // larger elements in arr[k+1..n-1] (also in arbitrary order).
     71    //
     72    // Could be changed to Select<T> where T is IComparable but in this case is significantly slower for double values
    7173    private static double Select(int k, double[] arr) {
    7274      Contract.Assert(arr.GetLowerBound(0) == 0);
     
    198200    }
    199201
    200     /// <summary>
    201     /// Calculates the pth percentile of the values.
    202     /// </summary>
    203     public static double Percentile(this IEnumerable<double> values, double p) {
    204       // percentiles are actually quantiles where alpha is constrained to integer percentage values from 1% to 99%
    205       return Quantile(values, p);
    206     }
    207 
    208202    public static IEnumerable<double> LimitToRange(this IEnumerable<double> values, double min, double max) {
    209203      if (min > max) throw new ArgumentException(string.Format("Minimum {0} is larger than maximum {1}.", min, max));
Note: See TracChangeset for help on using the changeset viewer.