29#include <casacore/casa/aips.h>
30#include <casacore/casa/Arrays/ArrayFwd.h>
31#include <casacore/casa/Utilities/Sort.h>
36template<
class T>
class Block;
149 int options = 0,
int nthread = 0);
152 static inline void swap (T&, T&);
251 static inline void swapInx (INX& index1, INX& index2);
261 static INX*
merge (
const T* data, INX* inx, INX* tmp, INX nrrec,
262 INX* index, INX nparts);
266 static inline int isAscending (
const T* data, INX index1, INX index2);
279 static INX
insSortAsc (INX* inx,
const T*, INX nr,
int option);
356template<
class T,
class INX=uInt>
362template<
class T,
class INX=uInt>
368template<
class T,
class INX=uInt>
375template<
class T,
class INX=uInt>
394template<
class T,
class INX>
401template<
class T,
class INX>
404 return (data[i] > data[j] || (data[i] == data[j] && i > j));
411#ifndef CASACORE_NO_AUTO_TEMPLATES
412#include <casacore/casa/Utilities/GenSort.tcc>
size_t nelements() const
The number of elements contained in this Block<T>.
General indirect sort functions.
static INX insSortAscNoDup(INX *inx, const T *, INX nr)
Insertion sort in ascending order allowing no duplicates.
static INX quickSort(INX *inx, const T *data, INX nr, Sort::Order, int options)
Sort container using quicksort.
static INX * merge(const T *data, INX *inx, INX *tmp, INX nrrec, INX *index, INX nparts)
Thedata buffer is divided in nparts parts.
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.
static void heapSortAsc(INX *inx, const T *, INX nr)
Heapsort in ascending order.
static void swapInx(INX &index1, INX &index2)
Swap 2 indices.
static INX insSort(INX *inx, const T *data, INX nr, Sort::Order, int options)
Sort container using insertion sort.
static INX insSortAsc(INX *inx, const T *, INX nr, int option)
Insertion sort in ascending order.
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.
static INX heapSort(INX *inx, const T *data, INX nr, Sort::Order, int options)
Sort container using heapsort.
static void heapAscSiftDown(INX *inx, INX, INX, const T *)
Helper function for ascending heapsort.
static INX insSortAscDup(INX *inx, const T *, INX nr)
Insertion sort in ascending order allowing duplicates.
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).
static INX kthLargest(T *data, INX nr, INX k)
Find the index of the k-th largest value.
static int isAscending(const T *data, INX index1, INX index2)
Check if 2 values are in ascending order.
static void quickSortAsc(INX *inx, const T *, INX nr, Bool multiThread=False, Int rec_lim=128)
Quicksort in ascending order.
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.
static uInt insSortAscDup(T *, Int)
Insertion sort in ascending order allowing duplicates.
static uInt sort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort a C-array containing nr T-type objects.
static uInt quickSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using quicksort.
static uInt sort(Block< T > &, uInt nr, Sort::Order=Sort::Ascending, int options=0)
static void reverse(T *data, const T *res, uInt nrrec)
Reverse the elements in res and put them into data.
static void heapAscSiftDown(Int, Int, T *)
Helper function for ascending heapsort.
static uInt sort(Array< T > &, Sort::Order=Sort::Ascending, int options=0)
static void swap(T &, T &)
Swap 2 elements in array.
static T * merge(T *data, T *tmp, uInt nrrec, uInt *index, uInt nparts)
Thedata buffer is divided in nparts parts.
static uInt insSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using insertion sort.
static uInt heapSort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort C-array using heapsort.
static void quickSortAsc(T *, Int, Bool multiThread=False, Int rec_lim=128)
Quicksort in ascending order.
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 heapSortAsc(T *, Int)
Heapsort in ascending order.
static uInt insSortAsc(T *, Int, int option)
Insertion sort in ascending order.
static uInt insSortAscNoDup(T *, Int)
Insertion sort in ascending order allowing no duplicates.
static T kthLargest(T *data, uInt nr, uInt k)
Find the k-th largest value.
Order
Enumerate the sort order:
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...
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.