casa
$Rev:20696$
|
General indirect sort functions. More...
#include <GenSort.h>
Static Public Member Functions | |
static uInt | sort (Vector< uInt > &indexVector, const T *data, uInt nr, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
Sort a C-array containing nr T -type objects. | |
static uInt | sort (Vector< uInt > &indexVector, const Array< T > &data, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
Sort a C-array containing nr T -type objects. | |
static uInt | sort (Vector< uInt > &indexVector, const Block< T > &data, uInt nr, Sort::Order=Sort::Ascending, int options=Sort::QuickSort) |
Sort a C-array containing nr T -type objects. | |
Static Private Member Functions | |
static uInt | quickSort (uInt *inx, const T *data, uInt nr, Sort::Order, int options) |
Sort container using quicksort. | |
static uInt | heapSort (uInt *inx, const T *data, uInt nr, Sort::Order, int options) |
Sort container using heapsort. | |
static uInt | insSort (uInt *inx, const T *data, uInt nr, Sort::Order, int options) |
Sort container using insertion sort. | |
static void | swapInx (uInt &index1, uInt &index2) |
Swap 2 indices. | |
static int | isAscending (const T *data, Int index1, Int index2) |
Check if 2 values are in ascending order. | |
static int | isDescending (const T *, Int index1, Int index2) |
Check if 2 values are in descending order. | |
static void | quickSortAsc (uInt *inx, const T *, Int nr) |
Quicksort in ascending order. | |
static void | quickSortDesc (uInt *inx, const T *, Int nr) |
Quicksort in descending order. | |
static void | heapSortAsc (uInt *inx, const T *, Int nr) |
Heapsort in ascending order. | |
static void | heapSortDesc (uInt *inx, const T *, Int nr) |
Heapsort in descending order. | |
static void | heapAscSiftDown (uInt *inx, Int, Int, const T *) |
Helper function for ascending heapsort. | |
static void | heapDescSiftDown (uInt *inx, Int, Int, const T *) |
Helper function for descending heapsort. | |
static uInt | insSortAsc (uInt *inx, const T *, Int nr, int option) |
Insertion sort in ascending order. | |
static uInt | insSortDesc (uInt *inx, const T *, Int nr, int option) |
Insertion sort in descending order. | |
static uInt | insSortAscDup (uInt *inx, const T *, Int nr) |
Insertion sort in ascending order allowing duplicates. | |
static uInt | insSortDescDup (uInt *inx, const T *, Int nr) |
Insertion sort in descending order allowing duplicates. | |
static uInt | insSortAscNoDup (uInt *inx, const T *, Int nr) |
Insertion sort in ascending order allowing no duplicates. | |
static uInt | insSortDescNoDup (uInt *inx, const T *, Int nr) |
Insertion sort in descending order allowing no duplicates. |
General indirect sort functions.
Internal
<h3>Synopsis</h3> This class is similar to \link casa::GenSort GenSort \endlink . 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).
static void casa::GenSortIndirect< T >::heapAscSiftDown | ( | uInt * | inx, |
Int | , | ||
Int | , | ||
const T * | |||
) | [static, private] |
Helper function for ascending heapsort.
static void casa::GenSortIndirect< T >::heapDescSiftDown | ( | uInt * | inx, |
Int | , | ||
Int | , | ||
const T * | |||
) | [static, private] |
Helper function for descending heapsort.
static uInt casa::GenSortIndirect< T >::heapSort | ( | uInt * | inx, |
const T * | data, | ||
uInt | nr, | ||
Sort::Order | , | ||
int | options | ||
) | [static, private] |
Sort container using heapsort.
static void casa::GenSortIndirect< T >::heapSortAsc | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Heapsort in ascending order.
static void casa::GenSortIndirect< T >::heapSortDesc | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Heapsort in descending order.
static uInt casa::GenSortIndirect< T >::insSort | ( | uInt * | inx, |
const T * | data, | ||
uInt | nr, | ||
Sort::Order | , | ||
int | options | ||
) | [static, private] |
Sort container using insertion sort.
static uInt casa::GenSortIndirect< T >::insSortAsc | ( | uInt * | inx, |
const T * | , | ||
Int | nr, | ||
int | option | ||
) | [static, private] |
Insertion sort in ascending order.
static uInt casa::GenSortIndirect< T >::insSortAscDup | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Insertion sort in ascending order allowing duplicates.
This is also used by quicksort for its last steps.
static uInt casa::GenSortIndirect< T >::insSortAscNoDup | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Insertion sort in ascending order allowing no duplicates.
This is also used by the other sort algorithms to skip duplicates.
static uInt casa::GenSortIndirect< T >::insSortDesc | ( | uInt * | inx, |
const T * | , | ||
Int | nr, | ||
int | option | ||
) | [static, private] |
Insertion sort in descending order.
static uInt casa::GenSortIndirect< T >::insSortDescDup | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Insertion sort in descending order allowing duplicates.
This is also used by quicksort for its last steps.
static uInt casa::GenSortIndirect< T >::insSortDescNoDup | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Insertion sort in descending order allowing no duplicates.
This is also used by the other sort algorithms to skip duplicates.
int casa::GenSortIndirect< T >::isAscending | ( | const T * | data, |
Int | index1, | ||
Int | index2 | ||
) | [inline, static, private] |
int casa::GenSortIndirect< T >::isDescending | ( | const T * | data, |
Int | index1, | ||
Int | index2 | ||
) | [inline, static, private] |
static uInt casa::GenSortIndirect< T >::quickSort | ( | uInt * | inx, |
const T * | data, | ||
uInt | nr, | ||
Sort::Order | , | ||
int | options | ||
) | [static, private] |
Sort container using quicksort.
static void casa::GenSortIndirect< T >::quickSortAsc | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Quicksort in ascending order.
static void casa::GenSortIndirect< T >::quickSortDesc | ( | uInt * | inx, |
const T * | , | ||
Int | nr | ||
) | [static, private] |
Quicksort in descending order.
static uInt casa::GenSortIndirect< T >::sort | ( | Vector< uInt > & | indexVector, |
const T * | data, | ||
uInt | nr, | ||
Sort::Order | = Sort::Ascending , |
||
int | options = Sort::QuickSort |
||
) | [static] |
Sort a C-array containing nr
T
-type objects.
The resulting index vector gives the sorted indices.
Referenced by casa::GenSort_global_functions_genSortIndirect::genSort().
static uInt casa::GenSortIndirect< T >::sort | ( | Vector< uInt > & | indexVector, |
const Array< T > & | data, | ||
Sort::Order | = Sort::Ascending , |
||
int | options = Sort::QuickSort |
||
) | [static] |
Sort a C-array containing nr
T
-type objects.
The resulting index vector gives the sorted indices.
static uInt casa::GenSortIndirect< T >::sort | ( | Vector< uInt > & | indexVector, |
const Block< T > & | data, | ||
uInt | nr, | ||
Sort::Order | = Sort::Ascending , |
||
int | options = Sort::QuickSort |
||
) | [static] |
Sort a C-array containing nr
T
-type objects.
The resulting index vector gives the sorted indices.
void casa::GenSortIndirect< T >::swapInx | ( | uInt & | index1, |
uInt & | index2 | ||
) | [inline, static, private] |