SSJ
3.2.1
Stochastic Simulation in Java
|
This interface is meant to be implemented by certain multivariate sorting algorithms that sort objects based on different fields (or dimensions). More...
Public Member Functions | |
void | sort (T[] a, int iMin, int iMax) |
Sorts the subarray of a made of the elements with indices from iMin to iMax-1 . More... | |
void | sort (T[] a) |
Sorts the entire array a . More... | |
void | sort (double[][] a, int iMin, int iMax) |
Sorts the subarray of a made of the elements with indices from iMin to iMax-1 , using the natural order for real numbers for each coordinate. More... | |
void | sort (double[][] a) |
Same as above, but sorts the entire array. More... | |
int | dimension () |
Returns the number of dimensions used in the sort. More... | |
This interface is meant to be implemented by certain multivariate sorting algorithms that sort objects based on different fields (or dimensions).
For example, in a list of animals, the animals can be sorted by both their age, their weight, and their market value, in three dimensions. For instance, one may want to regroup them based on their age, then split each group based on the weight, and finally sort the subgroups based on market value.
The objects to be sorted have \(d\) sorting fields (or coordinates), which means that they can be seen as \(d\)-dimensional and can be sorted according to any of the \(d\) coordinates, which are numbered from 0 to \(d-1\). These objects can be simply \(d\)-dimensional vectors of double
’s, which are sorted in the natural way according to any of the \(d\) coordinates. They can also be more general types of objects that implement the MultiDimComparable<T> interface, which is used to sort them on any given coordinate. The ordering is then the one induced by the method MultiDimComparable<T>.compareTo, and the number of the largest coordinate used by the sort must not exceed \(d-1\), where the dimension \(d\) refers to the value returned by umontreal.ssj.util.MultiDimComparable.dimension. One can sort only a subset of the objects, or all of them.
Certain types of sorts can use several coordinates at the same time to sort the objects; see the classes BatchSort and HilbertCurveSort, for example. These types of sorts have an application in particular in the array-RQMC method to simulate Markov chains [134] .
int dimension | ( | ) |
Returns the number of dimensions used in the sort.
void sort | ( | T [] | a, |
int | iMin, | ||
int | iMax | ||
) |
Sorts the subarray of a
made of the elements with indices from iMin
to iMax-1
.
a | array to sort |
iMin | index of first element to sort |
iMax | index of last element to sort is \(\mathtt{iMax}-1\) |
void sort | ( | T [] | a | ) |
Sorts the entire array a
.
a | array to sort |
void sort | ( | double | a[][], |
int | iMin, | ||
int | iMax | ||
) |
Sorts the subarray of a
made of the elements with indices from iMin
to iMax-1
, using the natural order for real numbers for each coordinate.
a | array to sort |
iMin | index of first element to sort |
iMax | index of last element to sort is \(\mathtt{iMax}-1\) |
void sort | ( | double | a[][] | ) |
Same as above, but sorts the entire array.
a | array to sort |