28 #ifndef CASA_GENSORT_H 29 #define CASA_GENSORT_H 31 #include <casacore/casa/aips.h> 32 #include <casacore/casa/Utilities/Sort.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);
251 static inline void swapInx (
uInt& index1,
uInt& index2);
266 static inline int isAscending (
const T* data,
Int index1,
Int index2);
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 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 void heapAscSiftDown(Int, Int, T *)
Helper function for ascending heapsort.
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 void reverse(T *data, const T *res, uInt nrrec)
Reverse the elements in res and put them into data.
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 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.
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.
size_t nelements() const
The number of elements contained in this Block<T>.
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 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.
this file contains all the compiler specific defines
static uInt insSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using insertion sort.
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...