28 #ifndef CASA_GENSORT_H
29 #define CASA_GENSORT_H
37 template<
class T>
class Array;
38 template<
class T>
class Vector;
39 template<
class T>
class Block;
152 int options = 0,
int nthread = 0);
155 static inline void swap (T&, T&);
159 static void reverse (T* data,
const T* res,
uInt nrrec);
403 return (data[i] > data[j] || (data[i] == data[j] && i > j));
410 #ifndef CASACORE_NO_AUTO_TEMPLATES
411 #include <casacore/casa/Utilities/GenSort.tcc>
412 #endif //# CASACORE_NO_AUTO_TEMPLATES
static uInt insSortAscNoDup(uInt *inx, const T *, Int nr)
Insertion sort in ascending order allowing no duplicates.
std::vector< double > Vector
static uInt quickSort(uInt *inx, const T *data, uInt nr, Sort::Order, int options)
Sort container using quicksort.
static T * merge(T *data, T *tmp, uInt nrrec, uInt *index, uInt nparts)
Thedata buffer is divided in nparts parts.
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 void heapSortAsc(T *, Int)
Heapsort in ascending order.
Order
Enumerate the sort order:
static uInt * merge(const T *data, uInt *inx, uInt *tmp, uInt nrrec, uInt *index, uInt nparts)
Thedata buffer is divided in nparts parts.
static void heapAscSiftDown(Int, Int, T *)
Helper function for ascending heapsort.
size_t nelements() const
The number of elements contained in this Block<T>.
static uInt insSortAscNoDup(T *, Int)
Insertion sort in ascending order allowing no duplicates.
static uInt parSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0, int nthread=0)
Sort C-array using parallel merge sort (using OpenMP).
static uInt heapSort(uInt *inx, const T *data, uInt nr, Sort::Order, int options)
Sort container using heapsort.
static void heapAscSiftDown(uInt *inx, Int, Int, const T *)
Helper function for ascending heapsort.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
static void reverse(T *data, const T *res, uInt nrrec)
Reverse the elements in res and put them into data.
uInt genSort(T *data, uInt nr, Sort::Order order=Sort::Ascending, int options=0)
Global in-place sort functions The following global functions are easier to use than the static GenSo...
static uInt insSortAsc(T *, Int, int option)
Insertion sort in ascending order.
static void swapInx(uInt &index1, uInt &index2)
Swap 2 indices.
General in-place sort functions.
static int isAscending(const T *data, Int index1, Int index2)
Check if 2 values are in ascending order.
static uInt parSort(uInt *inx, const T *data, uInt nr, Sort::Order, int options, int nthreads=0)
Sort container using parallel merge sort (using OpenMP).
static uInt heapSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using heapsort.
bool Bool
Define the standard types used by Casacore.
static uInt insSort(uInt *inx, const T *data, uInt nr, Sort::Order, int options)
Sort container using insertion sort.
template <class T, class U> class vector;
static void swap(T &, T &)
Swap 2 elements in array.
static uInt quickSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using quicksort.
static T kthLargest(T *data, uInt nr, uInt k)
Find the k-th largest value.
static void heapSortAsc(uInt *inx, const T *, Int nr)
Heapsort in ascending order.
static uInt insSortAsc(uInt *inx, const T *, Int nr, int option)
Insertion sort in ascending order.
static uInt insSortAscDup(uInt *inx, const T *, Int nr)
Insertion sort in ascending order allowing duplicates.
General indirect sort functions.
static uInt sort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort a C-array containing nr T-type objects.
static uInt kthLargest(T *data, uInt nr, uInt k)
Find the index of the k-th largest value.
static void quickSortAsc(T *, Int, Bool multiThread=False, Int rec_lim=128)
Quicksort in ascending order.
static uInt insSortAscDup(T *, Int)
Insertion sort in ascending order allowing duplicates.
static uInt insSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using insertion sort.
static void quickSortAsc(uInt *inx, const T *, Int nr, Bool multiThread=False, Int rec_lim=128)
Quicksort in ascending order.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.