SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
MultiDimSort< T > Interface Template Reference

This interface is meant to be implemented by certain multivariate sorting algorithms that sort objects based on different fields (or dimensions). More...

Inheritance diagram for MultiDimSort< T >:
[legend]

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...
 

Detailed Description

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 [139] .

Member Function Documentation

◆ dimension()

int dimension ( )

Returns the number of dimensions used in the sort.

Returns
number of dimensions used for the sort

◆ sort() [1/4]

void sort ( T []  a,
int  iMin,
int  iMax 
)

Sorts the subarray of a made of the elements with indices from iMin to iMax-1.

Parameters
aarray to sort
iMinindex of first element to sort
iMaxindex of last element to sort is \(\mathtt{iMax}-1\)

◆ sort() [2/4]

void sort ( T []  a)

Sorts the entire array a.

Parameters
aarray to sort

◆ sort() [3/4]

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.

Parameters
aarray to sort
iMinindex of first element to sort
iMaxindex of last element to sort is \(\mathtt{iMax}-1\)

◆ sort() [4/4]

void sort ( double  a[][])

Same as above, but sorts the entire array.

Parameters
aarray to sort

The documentation for this interface was generated from the following file: