Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

octave_sort< T > Class Template Reference

#include "oct-sort.h"

Collaboration diagram for octave_sort< T >:
Collaboration graph
[legend]

List of all members.

Classes

struct  MergeState
struct  s_slice

Public Types

typedef bool(* compare_fcn_type )(typename ref_param< T >::type, typename ref_param< T >::type)

Public Member Functions

 octave_sort (void)
 octave_sort (compare_fcn_type)
 ~octave_sort (void)
bool is_sorted (const T *data, octave_idx_type nel)
bool is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols)
octave_idx_type lookup (const T *data, octave_idx_type nel, const T &value)
void lookup (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx)
void lookup_sorted (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev=false)
void nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up=-1)
void set_compare (compare_fcn_type comp)
void set_compare (sortmode mode)
template<>
void sort (bool *data, octave_idx_type nel, std::greater< bool >)
void sort (T *data, octave_idx_type nel)
template<>
void sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::greater< bool >)
template<>
void sort (bool *data, octave_idx_type nel, std::less< bool >)
void sort (T *data, octave_idx_type *idx, octave_idx_type nel)
template<>
void sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::less< bool >)
void sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols)

Static Public Member Functions

static bool ascending_compare (typename ref_param< T >::type, typename ref_param< T >::type)
static bool descending_compare (typename ref_param< T >::type, typename ref_param< T >::type)

Private Member Functions

 octave_sort (const octave_sort &)
template<class Comp >
void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, octave_idx_type start, Comp comp)
template<class Comp >
void binarysort (T *data, octave_idx_type nel, octave_idx_type start, Comp comp)
template<class Comp >
octave_idx_type count_run (T *lo, octave_idx_type n, bool &descending, Comp comp)
template<class Comp >
octave_idx_type gallop_left (T key, T *a, octave_idx_type n, octave_idx_type hint, Comp comp)
template<class Comp >
octave_idx_type gallop_right (T key, T *a, octave_idx_type n, octave_idx_type hint, Comp comp)
template<class Comp >
bool is_sorted (const T *data, octave_idx_type nel, Comp comp)
template<class Comp >
bool is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols, Comp comp)
template<class Comp >
void lookup (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, Comp comp)
template<class Comp >
octave_idx_type lookup (const T *data, octave_idx_type nel, const T &value, Comp comp)
template<class Comp >
void lookup_sorted (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev, Comp comp)
template<class Comp >
int merge_at (octave_idx_type i, T *data, Comp comp)
template<class Comp >
int merge_at (octave_idx_type i, T *data, octave_idx_type *idx, Comp comp)
template<class Comp >
int merge_collapse (T *data, Comp comp)
template<class Comp >
int merge_collapse (T *data, octave_idx_type *idx, Comp comp)
octave_idx_type merge_compute_minrun (octave_idx_type n)
template<class Comp >
int merge_force_collapse (T *data, octave_idx_type *idx, Comp comp)
template<class Comp >
int merge_force_collapse (T *data, Comp comp)
template<class Comp >
int merge_hi (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp)
template<class Comp >
int merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp)
template<class Comp >
int merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp)
template<class Comp >
int merge_lo (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp)
template<class Comp >
void nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up, Comp comp)
octave_sortoperator= (const octave_sort &)
template<class Comp >
void sort (T *data, octave_idx_type *idx, octave_idx_type nel, Comp comp)
template<class Comp >
void sort (T *data, octave_idx_type nel, Comp comp)
template<class Comp >
void sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols, Comp comp)

Private Attributes

compare_fcn_type compare
MergeStatems

Detailed Description

template<class T>
class octave_sort< T >

Definition at line 106 of file oct-sort.h.


Member Typedef Documentation

template<class T>
typedef bool(* octave_sort< T >::compare_fcn_type)(typename ref_param< T >::type, typename ref_param< T >::type)

Definition at line 111 of file oct-sort.h.


Constructor & Destructor Documentation

template<class T >
octave_sort< T >::octave_sort ( void   ) 

Definition at line 120 of file oct-sort.cc.

template<class T >
octave_sort< T >::octave_sort ( compare_fcn_type  comp  ) 

Definition at line 126 of file oct-sort.cc.

template<class T >
octave_sort< T >::~octave_sort ( void   ) 

Definition at line 132 of file oct-sort.cc.

References octave_sort< T >::ms.

template<class T>
octave_sort< T >::octave_sort ( const octave_sort< T > &   )  [private]

Member Function Documentation

template<class T >
bool octave_sort< T >::ascending_compare ( typename ref_param< T >::type  x,
typename ref_param< T >::type  y 
) [static]
template<class T >
template<class Comp >
void octave_sort< T >::binarysort ( T *  data,
octave_idx_type  nel,
octave_idx_type  start,
Comp  comp 
) [private]

Definition at line 152 of file oct-sort.cc.

Referenced by octave_sort< T >::sort().

template<class T >
template<class Comp >
void octave_sort< T >::binarysort ( T *  data,
octave_idx_type idx,
octave_idx_type  nel,
octave_idx_type  start,
Comp  comp 
) [private]

Definition at line 196 of file oct-sort.cc.

template<class T >
template<class Comp >
octave_idx_type octave_sort< T >::count_run ( T *  lo,
octave_idx_type  n,
bool descending,
Comp  comp 
) [private]

Definition at line 262 of file oct-sort.cc.

Referenced by octave_sort< T >::sort().

template<class T >
bool octave_sort< T >::descending_compare ( typename ref_param< T >::type  x,
typename ref_param< T >::type  y 
) [static]
template<class T >
template<class Comp >
octave_idx_type octave_sort< T >::gallop_left ( key,
T *  a,
octave_idx_type  n,
octave_idx_type  hint,
Comp  comp 
) [private]
template<class T >
template<class Comp >
octave_idx_type octave_sort< T >::gallop_right ( key,
T *  a,
octave_idx_type  n,
octave_idx_type  hint,
Comp  comp 
) [private]
template<class T >
template<class Comp >
bool octave_sort< T >::is_sorted ( const T *  data,
octave_idx_type  nel,
Comp  comp 
) [private]

Definition at line 1543 of file oct-sort.cc.

References next.

template<class T >
bool octave_sort< T >::is_sorted ( const T *  data,
octave_idx_type  nel 
)
template<class T >
template<class Comp >
bool octave_sort< T >::is_sorted_rows ( const T *  data,
octave_idx_type  rows,
octave_idx_type  cols,
Comp  comp 
) [private]

Definition at line 1670 of file oct-sort.cc.

References octave_sort< T >::is_sorted().

template<class T >
bool octave_sort< T >::is_sorted_rows ( const T *  data,
octave_idx_type  rows,
octave_idx_type  cols 
)
template<class T >
octave_idx_type octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T &  value 
)
template<class T >
void octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx 
)
template<class T >
template<class Comp >
octave_idx_type octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T &  value,
Comp  comp 
) [private]

Definition at line 1751 of file oct-sort.cc.

template<class T >
template<class Comp >
void octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx,
Comp  comp 
) [private]

Definition at line 1793 of file oct-sort.cc.

References octave_sort< T >::lookup().

template<class T >
template<class Comp >
void octave_sort< T >::lookup_sorted ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx,
bool  rev,
Comp  comp 
) [private]

Definition at line 1826 of file oct-sort.cc.

template<class T >
void octave_sort< T >::lookup_sorted ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx,
bool  rev = false 
)
template<class T >
template<class Comp >
int octave_sort< T >::merge_at ( octave_idx_type  i,
T *  data,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_at ( octave_idx_type  i,
T *  data,
octave_idx_type idx,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_collapse ( T *  data,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_collapse ( T *  data,
octave_idx_type idx,
Comp  comp 
) [private]
template<class T >
octave_idx_type octave_sort< T >::merge_compute_minrun ( octave_idx_type  n  )  [private]

Definition at line 1372 of file oct-sort.cc.

Referenced by octave_sort< T >::sort().

template<class T >
template<class Comp >
int octave_sort< T >::merge_force_collapse ( T *  data,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_force_collapse ( T *  data,
octave_idx_type idx,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_hi ( T *  pa,
octave_idx_type  na,
T *  pb,
octave_idx_type  nb,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_hi ( T *  pa,
octave_idx_type ipa,
octave_idx_type  na,
T *  pb,
octave_idx_type ipb,
octave_idx_type  nb,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_lo ( T *  pa,
octave_idx_type  na,
T *  pb,
octave_idx_type  nb,
Comp  comp 
) [private]
template<class T >
template<class Comp >
int octave_sort< T >::merge_lo ( T *  pa,
octave_idx_type ipa,
octave_idx_type  na,
T *  pb,
octave_idx_type ipb,
octave_idx_type  nb,
Comp  comp 
) [private]
template<class T >
template<class Comp >
void octave_sort< T >::nth_element ( T *  data,
octave_idx_type  nel,
octave_idx_type  lo,
octave_idx_type  up,
Comp  comp 
) [private]

Definition at line 1898 of file oct-sort.cc.

References octave_sort< T >::nth_element().

template<class T >
void octave_sort< T >::nth_element ( T *  data,
octave_idx_type  nel,
octave_idx_type  lo,
octave_idx_type  up = -1 
)
template<class T>
octave_sort& octave_sort< T >::operator= ( const octave_sort< T > &   )  [private]
template<class T >
void octave_sort< T >::set_compare ( sortmode  mode  ) 

Definition at line 139 of file oct-sort.cc.

References ASCENDING, octave_sort< T >::compare, and DESCENDING.

template<class T>
void octave_sort< T >::set_compare ( compare_fcn_type  comp  )  [inline]
template<>
void octave_sort< bool >::sort ( bool data,
octave_idx_type  nel,
std::less< bool  
)

Definition at line 76 of file Array-b.cc.

template<>
void octave_sort< bool >::sort ( bool data,
octave_idx_type idx,
octave_idx_type  nel,
std::greater< bool  
)

Definition at line 100 of file Array-b.cc.

template<class T >
template<class Comp >
void octave_sort< T >::sort ( T *  data,
octave_idx_type idx,
octave_idx_type  nel,
Comp  comp 
) [private]
template<class T >
template<class Comp >
void octave_sort< T >::sort ( T *  data,
octave_idx_type  nel,
Comp  comp 
) [private]
template<>
void octave_sort< bool >::sort ( bool data,
octave_idx_type idx,
octave_idx_type  nel,
std::less< bool  
)

Definition at line 92 of file Array-b.cc.

template<class T >
void octave_sort< T >::sort ( T *  data,
octave_idx_type  nel 
)
template<class T >
void octave_sort< T >::sort ( T *  data,
octave_idx_type idx,
octave_idx_type  nel 
)
template<>
void octave_sort< bool >::sort ( bool data,
octave_idx_type  nel,
std::greater< bool  
)

Definition at line 84 of file Array-b.cc.

template<class T >
void octave_sort< T >::sort_rows ( const T *  data,
octave_idx_type idx,
octave_idx_type  rows,
octave_idx_type  cols 
)
template<class T >
template<class Comp >
void octave_sort< T >::sort_rows ( const T *  data,
octave_idx_type idx,
octave_idx_type  rows,
octave_idx_type  cols,
Comp  comp 
) [private]

Definition at line 1593 of file oct-sort.cc.

References OCTAVE_LOCAL_BUFFER, and octave_sort< T >::sort().


Member Data Documentation

template<class T>
compare_fcn_type octave_sort< T >::compare [private]
template<class T>
MergeState* octave_sort< T >::ms [private]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines