|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.util.BatchSort
public class BatchSort
BatchSort
This class implements a MultiDimSort that performs a batch sort on the arrays.
For MultiDimComparable objects, the dimension mentioned below refers to the value returned by umontreal.iro.lecuyer.utilMultiDimComparabledimension. The ordering of the elements is the one induced by the method umontreal.iro.lecuyer.utilMultiDimComparablecompareTo.
The batch sort separates the objects in n1 batches of equal size such that each object in a batch is smaller or equal, in dimension 1, to the objects in the next batches. Then, each batch is separated in n2 batches the same way but in dimension 2. And so on. The integers n1, n2,…, nd are given in the array batches in the constructor. The variable d must be smaller or equal to the dimension of the objects, and the product n1n2 ... nd must equal the number of objects in the array.
Batches can also be determined by an array of doubles α1, α2,…, αd, such that ni = nαi, where n is the number of objects in the array. This way, the condition on the batches is that the sum α1 + α2 + ... + αd must equal 1.
Constructor Summary | |
---|---|
BatchSort(double[] batchesExponents)
. |
|
BatchSort(int[] batches)
. |
Method Summary | ||
---|---|---|
int |
dimension()
Returns the greatest dimension used in the sort. |
|
void |
sort(double[][] a)
Sorts the entire array. |
|
void |
sort(double[][] a,
int iMin,
int iMax)
Sorts the subarray of a made of the elements with indices from iMin to iMax-1. |
|
|
sort(T[] a)
Sorts the entire array. |
|
|
sort(T[] a,
int iMin,
int iMax)
Sorts the subarray of a made of the elements with indices from iMin to iMax-1. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BatchSort(int[] batches)
public BatchSort(double[] batchesExponents)
Method Detail |
---|
public <T extends MultiDimComparable<? super T>> void sort(T[] a, int iMin, int iMax)
MultiDimSort
sort
in interface MultiDimSort
a
- array to sortiMin
- index of first element to sortiMax
- index of last element to sort is
public <T extends MultiDimComparable<? super T>> void sort(T[] a)
MultiDimSort
sort
in interface MultiDimSort
a
- array to sortpublic void sort(double[][] a, int iMin, int iMax)
MultiDimSort
sort
in interface MultiDimSort
a
- array to sortiMin
- index of first element to sortiMax
- index of last element to sort is
public void sort(double[][] a)
MultiDimSort
sort
in interface MultiDimSort
a
- array to sortpublic int dimension()
MultiDimSort
dimension
in interface MultiDimSort
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |