|
static INX | sort (Vector< INX > &indexVector, const T *data, INX nr, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
| Sort a C-array containing nr T -type objects. More...
|
|
static INX | sort (Vector< INX > &indexVector, const Array< T > &data, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
| Sort a C-array containing nr T -type objects. More...
|
|
static INX | sort (Vector< INX > &indexVector, const Block< T > &data, INX nr, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
| Sort a C-array containing nr T -type objects. More...
|
|
static INX | kthLargest (T *data, INX nr, INX k) |
| Find the index of the k-th largest value. More...
|
|
static INX | quickSort (INX *inx, const T *data, INX nr, Sort::Order, int options) |
| Sort container using quicksort. More...
|
|
static INX | heapSort (INX *inx, const T *data, INX nr, Sort::Order, int options) |
| Sort container using heapsort. More...
|
|
static INX | insSort (INX *inx, const T *data, INX nr, Sort::Order, int options) |
| Sort container using insertion sort. More...
|
|
static INX | parSort (INX *inx, const T *data, INX nr, Sort::Order, int options, int nthreads=0) |
| Sort container using parallel merge sort (using OpenMP). More...
|
|
|
static void | swapInx (INX &index1, INX &index2) |
| Swap 2 indices. More...
|
|
static INX * | merge (const T *data, INX *inx, INX *tmp, INX nrrec, INX *index, INX nparts) |
| Thedata buffer is divided in nparts parts. More...
|
|
static int | isAscending (const T *data, INX index1, INX index2) |
| Check if 2 values are in ascending order. More...
|
|
static void | quickSortAsc (INX *inx, const T *, INX nr, Bool multiThread=False, Int rec_lim=128) |
| Quicksort in ascending order. More...
|
|
static void | heapSortAsc (INX *inx, const T *, INX nr) |
| Heapsort in ascending order. More...
|
|
static void | heapAscSiftDown (INX *inx, INX, INX, const T *) |
| Helper function for ascending heapsort. More...
|
|
static INX | insSortAsc (INX *inx, const T *, INX nr, int option) |
| Insertion sort in ascending order. More...
|
|
static INX | insSortAscDup (INX *inx, const T *, INX nr) |
| Insertion sort in ascending order allowing duplicates. More...
|
|
static INX | insSortAscNoDup (INX *inx, const T *, INX nr) |
| Insertion sort in ascending order allowing no duplicates. More...
|
|
template<class T, class INX = uInt>
class casacore::GenSortIndirect< T, INX >
General indirect sort functions.
Intended use:
Internal
Synopsis
This class is similar to GenSort. The only difference is that the functions in this class sort indirectly instead of in-place. They return the result of the sort as an sorted vector of indices This is slower, because an extra indirection is involved in each comparison. However, this sort allows to sort const data. Another advantage is that this sort is always stable (i.e. equal values are kept in their original order).
Definition at line 205 of file GenSort.h.
template<class T , class INX = uInt>
static INX* casacore::GenSortIndirect< T, INX >::merge |
( |
const T * |
data, |
|
|
INX * |
inx, |
|
|
INX * |
tmp, |
|
|
INX |
nrrec, |
|
|
INX * |
index, |
|
|
INX |
nparts |
|
) |
| |
|
staticprivate |
Thedata
buffer is divided in nparts
parts.
In each part the values are in ascending order. The index tells the nr of elements in each part. Recursively each two subsequent parts are merged until only part is left (giving the sorted array). Alternately data
and tmp
are used for the merge result. The pointer containing the final result is returned.
If possible, merging the parts is done in parallel (using OpenMP).