Classes | Functions
contrib/mul/mbl/mbl_index_sort.h File Reference

Algorithm to produce list of sorted data indices. More...

#include <vcl_vector.h>
#include <vcl_algorithm.h>
#include <vcl_functional.h>

Go to the source code of this file.

Classes

struct  mbl_index_sort_cmp1< T >
 Implementation class - Do No Use. More...
struct  mbl_index_sort_cmp2< T >
 Implementation class - Do No Use. More...
struct  mbl_index_sort_cmp< T, INDEX, CONT, CMP >
 A comparator for general index sorting. More...

Functions

template<class T >
void mbl_index_sort (const T *data, int n, vcl_vector< int > &index)
 Sort n elements, giving the resulting order in index.
template<class T >
void mbl_index_sort (const T *data, unsigned n, vcl_vector< unsigned > &index)
 Sort n elements, giving the resulting order in index.
template<class T >
void mbl_index_sort (const vcl_vector< T > &data, vcl_vector< int > &index)
 Sort n elements, giving the resulting order in index.
template<class T >
void mbl_index_sort (const vcl_vector< T > &data, vcl_vector< unsigned > &index)
 Sort n elements, giving the resulting order in index.

Detailed Description

Algorithm to produce list of sorted data indices.

Author:
Ian Scott

Definition in file mbl_index_sort.h.


Function Documentation

template<class T >
void mbl_index_sort ( const T *  data,
int  n,
vcl_vector< int > &  index 
)

Sort n elements, giving the resulting order in index.

data[index[0]] is smallest element, data[index[n-1]] is largest

Definition at line 26 of file mbl_index_sort.h.

template<class T >
void mbl_index_sort ( const T *  data,
unsigned  n,
vcl_vector< unsigned > &  index 
)

Sort n elements, giving the resulting order in index.

data[index[0]] is smallest element, data[index[n-1]] is largest

Definition at line 40 of file mbl_index_sort.h.

template<class T >
void mbl_index_sort ( const vcl_vector< T > &  data,
vcl_vector< int > &  index 
)

Sort n elements, giving the resulting order in index.

data[index[0]] is smallest element, data[index[n-1]] is largest

Definition at line 65 of file mbl_index_sort.h.

template<class T >
void mbl_index_sort ( const vcl_vector< T > &  data,
vcl_vector< unsigned > &  index 
)

Sort n elements, giving the resulting order in index.

data[index[0]] is smallest element, data[index[n-1]] is largest

Note:
to get a sorted list, apply sorted[i] = data[index[i]], for all i.

Definition at line 81 of file mbl_index_sort.h.