org.jmat.data.matrixTools
Class Sorting

java.lang.Object
  |
  +--org.jmat.data.matrixTools.Sorting

public class Sorting
extends java.lang.Object

Quick Sort algoritm.

Allows to sort a column quickly, Using a generic version of C.A.R Hoare's Quick Sort algorithm.


Constructor Summary
Sorting(double[] array, boolean copyArray)
          Construct an ascending order.
 
Method Summary
 int[] getIndex()
          Get the ascending order of all lines.
 int getIndex(int i)
          Get the ascending order of one line.
 Matrix getIndexMatrix()
          Get the ascending order of all lines.
static void main(java.lang.String[] args)
           
static Matrix MatrixColumns(Matrix X, int i)
          Sort columns of a Matrix
static Matrix MatrixColumnsIndex(Matrix X, int i)
          Sort columns of a Matrix
static Matrix MatrixRows(Matrix X, int j)
          Sort rows of a Matrix
static Matrix MatrixRowsIndex(Matrix X, int j)
          Sort rows of a Matrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sorting

public Sorting(double[] array,
               boolean copyArray)
Construct an ascending order.

Parameters:
array - Array to sort.
copyArray - Specify if the sort is made directly : true -> array is modified (usefull for big arrays !), false -> array is copied and not modified (more memory used).
Method Detail

MatrixRowsIndex

public static Matrix MatrixRowsIndex(Matrix X,
                                     int j)
Sort rows of a Matrix

Parameters:
X - Matrix to sort
j - index of the column to sort
Returns:
a Matrix

MatrixColumnsIndex

public static Matrix MatrixColumnsIndex(Matrix X,
                                        int i)
Sort columns of a Matrix

Parameters:
X - Matrix to sort
i - index of the row to sort
Returns:
a Matrix

MatrixRows

public static Matrix MatrixRows(Matrix X,
                                int j)
Sort rows of a Matrix

Parameters:
X - Matrix to sort
j - index of the column to sort
Returns:
a Matrix

MatrixColumns

public static Matrix MatrixColumns(Matrix X,
                                   int i)
Sort columns of a Matrix

Parameters:
X - Matrix to sort
i - index of the row to sort
Returns:
a Matrix

getIndex

public int getIndex(int i)
Get the ascending order of one line.

Parameters:
i - Line number.
Returns:
Ascending order of the line.

getIndex

public int[] getIndex()
Get the ascending order of all lines.

Returns:
Ascending order of lines.

getIndexMatrix

public Matrix getIndexMatrix()
Get the ascending order of all lines.

Returns:
Ascending order of lines.

main

public static void main(java.lang.String[] args)