casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Static Public Member Functions | Static Private Member Functions
casa::GenSortIndirect< T > Class Template Reference

General indirect sort functions. More...

#include <GenSort.h>

List of all members.

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.

Detailed Description

template<class T>
class casa::GenSortIndirect< T >

General indirect sort functions.

Intended use:

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).

Definition at line 189 of file GenSort.h.


Member Function Documentation

template<class T >
static void casa::GenSortIndirect< T >::heapAscSiftDown ( uInt inx,
Int  ,
Int  ,
const T *   
) [static, private]

Helper function for ascending heapsort.

template<class T >
static void casa::GenSortIndirect< T >::heapDescSiftDown ( uInt inx,
Int  ,
Int  ,
const T *   
) [static, private]

Helper function for descending heapsort.

template<class T >
static uInt casa::GenSortIndirect< T >::heapSort ( uInt inx,
const T *  data,
uInt  nr,
Sort::Order  ,
int  options 
) [static, private]

Sort container using heapsort.

template<class T >
static void casa::GenSortIndirect< T >::heapSortAsc ( uInt inx,
const T *  ,
Int  nr 
) [static, private]

Heapsort in ascending order.

template<class T >
static void casa::GenSortIndirect< T >::heapSortDesc ( uInt inx,
const T *  ,
Int  nr 
) [static, private]

Heapsort in descending order.

template<class T >
static uInt casa::GenSortIndirect< T >::insSort ( uInt inx,
const T *  data,
uInt  nr,
Sort::Order  ,
int  options 
) [static, private]

Sort container using insertion sort.

template<class T >
static uInt casa::GenSortIndirect< T >::insSortAsc ( uInt inx,
const T *  ,
Int  nr,
int  option 
) [static, private]

Insertion sort in ascending order.

template<class T >
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.

template<class T >
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.

template<class T >
static uInt casa::GenSortIndirect< T >::insSortDesc ( uInt inx,
const T *  ,
Int  nr,
int  option 
) [static, private]

Insertion sort in descending order.

template<class T >
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.

template<class T >
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.

template<class T >
int casa::GenSortIndirect< T >::isAscending ( const T *  data,
Int  index1,
Int  index2 
) [inline, static, private]

Check if 2 values are in ascending order.

When equal, the order is correct if index1<index2.

Definition at line 541 of file GenSort.h.

template<class T >
int casa::GenSortIndirect< T >::isDescending ( const T *  data,
Int  index1,
Int  index2 
) [inline, static, private]

Check if 2 values are in descending order.

When equal, the order is correct if index1<index2.

Definition at line 546 of file GenSort.h.

template<class T >
static uInt casa::GenSortIndirect< T >::quickSort ( uInt inx,
const T *  data,
uInt  nr,
Sort::Order  ,
int  options 
) [static, private]

Sort container using quicksort.

template<class T >
static void casa::GenSortIndirect< T >::quickSortAsc ( uInt inx,
const T *  ,
Int  nr 
) [static, private]

Quicksort in ascending order.

template<class T >
static void casa::GenSortIndirect< T >::quickSortDesc ( uInt inx,
const T *  ,
Int  nr 
) [static, private]

Quicksort in descending order.

template<class T >
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().

template<class T >
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.

template<class T >
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.

template<class T >
void casa::GenSortIndirect< T >::swapInx ( uInt index1,
uInt index2 
) [inline, static, private]

Swap 2 indices.

Definition at line 534 of file GenSort.h.


The documentation for this class was generated from the following file: