Package org.apache.sysds.runtime.util
Class SortUtils
java.lang.Object
org.apache.sysds.runtime.util.SortUtils
Utilities for sorting, primarily used for SparseRows.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(double[] d1, double[] d2) static booleanisSorted(int start, int end, double[] values) static booleanisSorted(int start, int end, int[] indexes) static booleanisSorted(MatrixBlock in) static voidsortByIndex(int start, int end, int[] indexes, double[] values) In-place sort of two arrays, only indexes is used for comparison and values of same position are sorted accordingly.static voidsortByIndex(int start, int end, int[] indexes, int[] indexes2, double[] values) In-place sort of three arrays, only first indexes is used for comparison and second indexes as well as values of same position are sorted accordingly.static voidsortByValue(int start, int end, double[] values, int[] indexes) static voidsortByValueStable(int start, int end, double[] values, int[] indexes) In-place sort of two arrays, only indexes is used for comparison and values of same position are sorted accordingly.
-
Constructor Details
-
SortUtils
public SortUtils()
-
-
Method Details
-
isSorted
public static boolean isSorted(int start, int end, int[] indexes) -
isSorted
public static boolean isSorted(int start, int end, double[] values) -
isSorted
-
compare
public static int compare(double[] d1, double[] d2) -
sortByIndex
public static void sortByIndex(int start, int end, int[] indexes, double[] values) In-place sort of two arrays, only indexes is used for comparison and values of same position are sorted accordingly.- Parameters:
start- starting indexend- ending indexindexes- array of indexes to sort byvalues- double array of values to sort
-
sortByIndex
public static void sortByIndex(int start, int end, int[] indexes, int[] indexes2, double[] values) In-place sort of three arrays, only first indexes is used for comparison and second indexes as well as values of same position are sorted accordingly.- Parameters:
start- starting indexend- ending indexindexes- ?indexes2- ?values- ?
-
sortByValue
public static void sortByValue(int start, int end, double[] values, int[] indexes) -
sortByValueStable
public static void sortByValueStable(int start, int end, double[] values, int[] indexes) In-place sort of two arrays, only indexes is used for comparison and values of same position are sorted accordingly.- Parameters:
start- start indexend- end indexvalues- double array of values to sortindexes- int array of indexes to sort by
-