Package com.polytechnik.utils
Class SortArrays
java.lang.Object
com.polytechnik.utils.SortArrays
Sort arrays simple utils using insertion sort.
Use this instead of java.util.Arrays for small size arrays, typically polynomial roots.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static int[]
sortArrayIndexes
(double[] compare_values) The same assortArrayIndexes(compare_values.length,IntPTRCompare.sortAscending(compare_values))
.static int[]
sortArrayIndexes
(int n, IntPTRCompare c) Sort Array indexes.static void
sortArrayWith2Load
(int n, double[] tosort, double[] load1, double[] load2) static void
sortArrayWith2LoadDesc
(int n, double[] tosort, double[] load1, double[] load2) static void
sortArrayWithLoad
(int n, double[] tosort, double[] load) static void
sortArrayWithLoadDesc
(int n, double[] tosort, double[] load) (package private) static void
sortArrayWithLoads
(int n, double[] tosort, double[] load1, double[] load2, boolean flag_asc) private static void
test_load_index
(int n, double[] d0, double[] d_sorted, double[] index) (package private) static void
test_load_index
(int n, double[] d0, double[] d_sorted, int[] index) (package private) static void
test_ordered
(int n, double[] d, boolean flag_asc) private static void
test_sortArray
(Random r, double eps, int n_tests) private static void
test_sortArrayIndexes
(Random r, double eps, int n_tests)
-
Constructor Details
-
SortArrays
public SortArrays()
-
-
Method Details
-
sortArrayWithLoad
public static void sortArrayWithLoad(int n, double[] tosort, double[] load) -
sortArrayWith2Load
public static void sortArrayWith2Load(int n, double[] tosort, double[] load1, double[] load2) -
sortArrayWithLoadDesc
public static void sortArrayWithLoadDesc(int n, double[] tosort, double[] load) -
sortArrayWith2LoadDesc
public static void sortArrayWith2LoadDesc(int n, double[] tosort, double[] load1, double[] load2) -
sortArrayWithLoads
static void sortArrayWithLoads(int n, double[] tosort, double[] load1, double[] load2, boolean flag_asc) -
sortArrayIndexes
public static int[] sortArrayIndexes(double[] compare_values) The same assortArrayIndexes(compare_values.length,IntPTRCompare.sortAscending(compare_values))
. -
sortArrayIndexes
Sort Array indexes.- Parameters:
n
- The number of elements to sort.c
- Comparator.- Returns:
- index array, the (l,m) elements of which are sorted according to c.compare(index[l],index[m]).
-
test_ordered
static void test_ordered(int n, double[] d, boolean flag_asc) -
test_load_index
private static void test_load_index(int n, double[] d0, double[] d_sorted, double[] index) -
test_load_index
static void test_load_index(int n, double[] d0, double[] d_sorted, int[] index) -
test_sortArray
-
test_sortArrayIndexes
-
main
-