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 ; }
Sorts each variable and returns the index of values in ascending order . Note that the order of original array is NOT altered .