smile.sort.QuickSort.sort()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中smile.sort.QuickSort.sort方法的一些代码示例,展示了QuickSort.sort的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QuickSort.sort方法的具体详情如下:
包路径:smile.sort.QuickSort
类名称:QuickSort
方法名:sort

QuickSort.sort介绍

[英]Sorts the specified array into ascending numerical order.
[中]将指定数组按升序进行排序。

代码示例

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Sorts the specified array into ascending numerical order.
 * @return the original index of elements after sorting in range [0, n).
 */
public static int[] sort(int[] arr) {
  int[] order = new int[arr.length];
  for (int i = 0; i < order.length; i++) {
    order[i] = i;
  }
  sort(arr, order);
  return order;
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Sorts the specified array into ascending order.
 * @return the original index of elements after sorting in range [0, n).
 */
public static <T extends Comparable<? super T>>  int[] sort(T[] arr) {
  int[] order = new int[arr.length];
  for (int i = 0; i < order.length; i++) {
    order[i] = i;
  }
  sort(arr, order);
  return order;
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Sorts the specified array into ascending numerical order.
 * @return the original index of elements after sorting in range [0, n).
 */
public static int[] sort(double[] arr) {
  int[] order = new int[arr.length];
  for (int i = 0; i < order.length; i++) {
    order[i] = i;
  }
  sort(arr, order);
  return order;
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static <T extends Comparable<? super T>>  void sort(T[] arr, int[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Sorts the specified array into ascending numerical order.
 * @return the original index of elements after sorting in range [0, n).
 */
public static int[] sort(float[] arr) {
  int[] order = new int[arr.length];
  for (int i = 0; i < order.length; i++) {
    order[i] = i;
  }
  sort(arr, order);
  return order;
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(double[] arr, Object[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static <T extends Comparable<? super T>>  void sort(T[] arr, Object[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(int[] arr, Object[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(float[] arr, Object[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * This is an effecient implementation Quick Sort algorithm without
 * recursive. Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(double[] arr, double[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(int[] arr, int[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(float[] arr, int[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(float[] arr, float[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Besides sorting the array arr, the array brr will be also
 * rearranged as the same order of arr.
 */
public static void sort(double[] arr, int[] brr) {
  sort(arr, brr, arr.length);
}

代码示例来源:origin: com.github.haifengl/smile-math

/**
 * Sorts each variable and returns the index of values in ascending order.
 * Note that the order of original array is NOT altered.
 * 
 * @param x a set of variables to be sorted. Each row is an instance. Each
 * column is a variable.
 * @return the index of values in ascending order
 */
public static int[][] sort(double[][] x) {
  int n = x.length;
  int p = x[0].length;
  
  double[] a = new double[n];
  int[][] index = new int[p][];
  
  for (int j = 0; j < p; j++) {
    for (int i = 0; i < n; i++) {
      a[i] = x[i][j];
    }
    index[j] = QuickSort.sort(a);
  }
  
  return index;
}

代码示例来源:origin: io.github.myui/hivemall-core

@Nonnull
public static int[][] sort(@Nonnull final Attribute[] attributes, @Nonnull final double[][] x) {
  final int n = x.length;
  final int p = x[0].length;
  final double[] a = new double[n];
  final int[][] index = new int[p][];
  for (int j = 0; j < p; j++) {
    if (attributes[j].type == AttributeType.NUMERIC) {
      for (int i = 0; i < n; i++) {
        a[i] = x[i][j];
      }
      index[j] = QuickSort.sort(a);
    }
  }
  return index;
}

代码示例来源:origin: com.github.haifengl/smile-core

/**
 * Sorts each variable and returns the index of values in ascending order.
 * Only numeric attributes will be sorted. Note that the order of original
 * array is NOT altered.
 * 
 * @param x a set of variables to be sorted. Each row is an instance. Each
 * column is a variable.
 * @return the index of values in ascending order
 */
public static int[][] sort(Attribute[] attributes, double[][] x) {
  int n = x.length;
  int p = x[0].length;
  
  double[] a = new double[n];
  int[][] index = new int[p][];
  
  for (int j = 0; j < p; j++) {
    if (attributes[j].getType() == Attribute.Type.NUMERIC) {
      for (int i = 0; i < n; i++) {
        a[i] = x[i][j];
      }
      index[j] = QuickSort.sort(a);
    }
  }
  
  return index;        
}

代码示例来源:origin: com.github.haifengl/smile-math

QuickSort.sort(wksp1, wksp2);
double sf = crank(wksp1);
QuickSort.sort(wksp2, wksp1);
double sg = crank(wksp2);

代码示例来源:origin: com.github.haifengl/smile-math

QuickSort.sort(wksp1, wksp2);
double sf = crank(wksp1);
QuickSort.sort(wksp2, wksp1);
double sg = crank(wksp2);

代码示例来源:origin: com.github.haifengl/smile-math

QuickSort.sort(wksp1, wksp2);
double sf = crank(wksp1);
QuickSort.sort(wksp2, wksp1);
double sg = crank(wksp2);

相关文章

QuickSort类方法