Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/07/17 13:15:55 (6 years ago)
Author:
bwerth
Message:

#2847 added WeightedEuclideanDistance && fixed minor bug in scatterPlot colloring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Weighted TSNE/3.4/TSNE/TSNEUtils.cs

    r14414 r15455  
    3535    }
    3636
    37     internal static IList<T> Swap<T>(this IList<T> list, int indexA, int indexB) {
     37    internal static void Swap<T>(this IList<T> list, int indexA, int indexB) {
    3838      var tmp = list[indexA];
    3939      list[indexA] = list[indexB];
    4040      list[indexB] = tmp;
    41       return list;
    4241    }
    4342
    44     internal static int Partition<T>(this IList<T> list, int left, int right, int pivotindex, IComparer<T> comparer) {
     43    private static int Partition<T>(this IList<T> list, int left, int right, int pivotindex, IComparer<T> comparer) {
    4544      var pivotValue = list[pivotindex];
    4645      list.Swap(pivotindex, right);
     
    6766    /// <param name="comparer">comparer for list elemnts </param>
    6867    /// <returns></returns>
    69     internal static T NthElement<T>(this IList<T> list, int left, int right, int n, IComparer<T> comparer) {
     68    internal static void NthElement<T>(this IList<T> list, int left, int right, int n, IComparer<T> comparer) {
    7069      while (true) {
    71         if (left == right) return list[left];
    72         var pivotindex = left + (int)Math.Floor(new System.Random().Next() % (right - (double)left + 1));
     70        if (left == right) return;
     71        var pivotindex = left + (int) Math.Floor(new System.Random().Next() % (right - (double) left + 1));
    7372        pivotindex = list.Partition(left, right, pivotindex, comparer);
    74         if (n == pivotindex) return list[n];
     73        if (n == pivotindex) return;
    7574        if (n < pivotindex) right = pivotindex - 1;
    7675        else left = pivotindex + 1;
Note: See TracChangeset for help on using the changeset viewer.