/** * Returns the indices of the array sorted in ascending order. This is * accomplished by a call to sortArrayAscending and then swapping the * result. As such, this will always be the slower of the two calls. * @param valuesToSort values that should be sorted in descending order * @return indices of the descending-ordered valuesToSort, so that * index[0] is the biggest value, and index[index.length-1] is the smallest */ public static int[] sortArrayDescending( double[] valuesToSort ) { int M = valuesToSort.length; int[] ascendingIndices = ArrayIndexSorter.sortArrayAscending( valuesToSort ); int[] descendingIndices = new int[ M ]; for( int i = 0; i < M; i++ ) { descendingIndices[i] = ascendingIndices[M-i-1]; } return descendingIndices; }
/** * Returns the indices of the array sorted in ascending order. This is * accomplished by a call to sortArrayAscending and then swapping the * result. As such, this will always be the slower of the two calls. * @param valuesToSort values that should be sorted in descending order * @return indices of the descending-ordered valuesToSort, so that * index[0] is the biggest value, and index[index.length-1] is the smallest */ public static int[] sortArrayDescending( double[] valuesToSort ) { int M = valuesToSort.length; int[] ascendingIndices = ArrayIndexSorter.sortArrayAscending( valuesToSort ); int[] descendingIndices = new int[ M ]; for( int i = 0; i < M; i++ ) { descendingIndices[i] = ascendingIndices[M-i-1]; } return descendingIndices; }
/** * Returns the indices of the array sorted in ascending order. This is * accomplished by a call to sortArrayAscending and then swapping the * result. As such, this will always be the slower of the two calls. * @param valuesToSort values that should be sorted in descending order * @return indices of the descending-ordered valuesToSort, so that * index[0] is the biggest value, and index[index.length-1] is the smallest */ public static int[] sortArrayDescending( double[] valuesToSort ) { int M = valuesToSort.length; int[] ascendingIndices = ArrayIndexSorter.sortArrayAscending( valuesToSort ); int[] descendingIndices = new int[ M ]; for( int i = 0; i < M; i++ ) { descendingIndices[i] = ascendingIndices[M-i-1]; } return descendingIndices; }
index++; int[] sortedIndices = ArrayIndexSorter.sortArrayAscending( array ); double[] ranks = new double[ N ];
index++; int[] sortedIndices = ArrayIndexSorter.sortArrayAscending( array ); double[] ranks = new double[ N ];
index++; int[] sortedIndices = ArrayIndexSorter.sortArrayAscending( array ); double[] ranks = new double[ N ];
ArrayIndexSorter.sortArrayAscending(pvalues);
ArrayIndexSorter.sortArrayAscending(pvalues);
ArrayIndexSorter.sortArrayAscending(pvalues);
ArrayIndexSorter.sortArrayAscending(pvalues);
ArrayIndexSorter.sortArrayAscending(pvalues);
ArrayIndexSorter.sortArrayAscending(pvalues);