#include "oct-sort.h"
Classes | |
struct | MergeState |
struct | s_slice |
Public Types | |
typedef bool(* | compare_fcn_type) (typename ref_param< T >::type, typename ref_param< T >::type) |
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 | |
template<typename Comp > | |
void | binarysort (T *data, octave_idx_type nel, octave_idx_type start, Comp comp) |
template<typename Comp > | |
void | binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, octave_idx_type start, Comp comp) |
template<typename Comp > | |
octave_idx_type | count_run (T *lo, octave_idx_type n, bool &descending, Comp comp) |
template<typename Comp > | |
octave_idx_type | gallop_left (T key, T *a, octave_idx_type n, octave_idx_type hint, Comp comp) |
template<typename Comp > | |
octave_idx_type | gallop_right (T key, T *a, octave_idx_type n, octave_idx_type hint, Comp comp) |
template<typename Comp > | |
bool | is_sorted (const T *data, octave_idx_type nel, Comp comp) |
template<typename Comp > | |
bool | is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols, Comp comp) |
template<typename Comp > | |
bool | issorted (const T *data, octave_idx_type nel, Comp comp) |
template<typename Comp > | |
octave_idx_type | lookup (const T *data, octave_idx_type nel, const T &value, Comp comp) |
template<typename Comp > | |
void | lookup (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, Comp comp) |
template<typename 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<typename Comp > | |
int | merge_at (octave_idx_type i, T *data, Comp comp) |
template<typename Comp > | |
int | merge_at (octave_idx_type i, T *data, octave_idx_type *idx, Comp comp) |
template<typename Comp > | |
int | merge_collapse (T *data, Comp comp) |
template<typename Comp > | |
int | merge_collapse (T *data, octave_idx_type *idx, Comp comp) |
octave_idx_type | merge_compute_minrun (octave_idx_type n) |
template<typename Comp > | |
int | merge_force_collapse (T *data, Comp comp) |
template<typename Comp > | |
int | merge_force_collapse (T *data, octave_idx_type *idx, Comp comp) |
template<typename Comp > | |
int | merge_hi (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp) |
template<typename 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<typename Comp > | |
int | merge_lo (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp) |
template<typename 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<typename Comp > | |
void | nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up, Comp comp) |
template<typename Comp > | |
void | sort (T *data, octave_idx_type nel, Comp comp) |
template<typename Comp > | |
void | sort (T *data, octave_idx_type *idx, octave_idx_type nel, Comp comp) |
template<typename 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 |
MergeState * | ms |
Definition at line 108 of file oct-sort.h.
typedef bool(* octave_sort< T >::compare_fcn_type) (typename ref_param< T >::type, typename ref_param< T >::type) |
Definition at line 113 of file oct-sort.h.
octave_sort< T >::octave_sort | ( | void | ) |
Definition at line 120 of file oct-sort.cc.
octave_sort< T >::octave_sort | ( | compare_fcn_type | comp | ) |
Definition at line 125 of file oct-sort.cc.
|
delete |
octave_sort< T >::~octave_sort | ( | void | ) |
Definition at line 130 of file oct-sort.cc.
|
static |
Definition at line 1954 of file oct-sort.cc.
Referenced by octave_sort< T >::is_sorted_rows(), octave_sort< T >::issorted(), octave_sort< T >::lookup(), octave_sort< T >::lookup_sorted(), octave_sort< T >::nth_element(), octave_sort< T >::sort(), and octave_sort< T >::sort_rows().
|
private |
Definition at line 150 of file oct-sort.cc.
References p, start, and swap.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 195 of file oct-sort.cc.
|
private |
Definition at line 262 of file oct-sort.cc.
Referenced by octave_sort< T >::sort().
|
static |
Definition at line 1962 of file oct-sort.cc.
Referenced by octave_sort< T >::is_sorted_rows(), octave_sort< T >::issorted(), octave_sort< T >::lookup(), Array< octave_value >::lookup(), octave_sort< T >::lookup_sorted(), octave_sort< T >::nth_element(), octave_sort< T >::sort(), and octave_sort< T >::sort_rows().
|
private |
Definition at line 322 of file oct-sort.cc.
Referenced by octave_sort< T >::merge_at(), octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().
|
private |
Definition at line 417 of file oct-sort.cc.
Referenced by octave_sort< T >::merge_at(), octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().
|
inline |
Definition at line 142 of file oct-sort.h.
|
inlineprivate |
Definition at line 316 of file oct-sort.h.
bool octave_sort< T >::is_sorted_rows | ( | const T * | data, |
octave_idx_type | rows, | ||
octave_idx_type | cols | ||
) |
Definition at line 1727 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), and retval.
Referenced by Array< octave_value >::is_sorted_rows().
|
private |
Definition at line 1670 of file oct-sort.cc.
References octave_sort< T >::issorted().
bool octave_sort< T >::issorted | ( | const T * | data, |
octave_idx_type | nel | ||
) |
Definition at line 1563 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), and retval.
Referenced by octave_sort< T >::is_sorted_rows(), and Array< octave_value >::issorted().
|
private |
Definition at line 1543 of file oct-sort.cc.
References next.
octave_idx_type octave_sort< T >::lookup | ( | const T * | data, |
octave_idx_type | nel, | ||
const T & | value | ||
) |
Definition at line 1773 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), retval, and value.
Referenced by octave_sort< T >::lookup(), and Array< octave_value >::lookup().
void octave_sort< T >::lookup | ( | const T * | data, |
octave_idx_type | nel, | ||
const T * | values, | ||
octave_idx_type | nvalues, | ||
octave_idx_type * | idx | ||
) |
Definition at line 1810 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), octave_sort< T >::lookup(), and values.
|
private |
Definition at line 1753 of file oct-sort.cc.
References value.
|
private |
Definition at line 1797 of file oct-sort.cc.
References octave_sort< T >::lookup(), and values.
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 |
||
) |
Definition at line 1885 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), and values.
Referenced by Array< octave_value >::lookup().
|
private |
Definition at line 1831 of file oct-sort.cc.
|
private |
Definition at line 1150 of file oct-sort.cc.
References octave_sort< T >::s_slice::base, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), i, k, octave_sort< T >::s_slice::len, octave_sort< T >::merge_hi(), octave_sort< T >::merge_lo(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, and octave_sort< T >::MergeState::pending.
Referenced by octave_sort< T >::merge_collapse(), and octave_sort< T >::merge_force_collapse().
|
private |
Definition at line 1201 of file oct-sort.cc.
References octave_sort< T >::s_slice::base, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), i, k, octave_sort< T >::s_slice::len, octave_sort< T >::merge_hi(), octave_sort< T >::merge_lo(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, and octave_sort< T >::MergeState::pending.
|
private |
Definition at line 1265 of file oct-sort.cc.
References octave_sort< T >::merge_at(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, p, and octave_sort< T >::MergeState::pending.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1294 of file oct-sort.cc.
References octave_sort< T >::merge_at(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, p, and octave_sort< T >::MergeState::pending.
|
private |
Definition at line 1375 of file oct-sort.cc.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1328 of file oct-sort.cc.
References octave_sort< T >::merge_at(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, p, and octave_sort< T >::MergeState::pending.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1347 of file oct-sort.cc.
References octave_sort< T >::merge_at(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, p, and octave_sort< T >::MergeState::pending.
|
private |
Definition at line 863 of file oct-sort.cc.
References octave_sort< T >::MergeState::a, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmem(), k, MIN_GALLOP, octave_sort< T >::MergeState::min_gallop, octave_sort< T >::ms, and result.
Referenced by octave_sort< T >::merge_at().
|
private |
Definition at line 1000 of file oct-sort.cc.
References octave_sort< T >::MergeState::a, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::MergeState::ia, k, MIN_GALLOP, octave_sort< T >::MergeState::min_gallop, octave_sort< T >::ms, and result.
|
private |
Definition at line 581 of file oct-sort.cc.
References octave_sort< T >::MergeState::a, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmem(), k, MIN_GALLOP, octave_sort< T >::MergeState::min_gallop, octave_sort< T >::ms, and result.
Referenced by octave_sort< T >::merge_at().
|
private |
Definition at line 716 of file oct-sort.cc.
References octave_sort< T >::MergeState::a, octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::MergeState::ia, k, MIN_GALLOP, octave_sort< T >::MergeState::min_gallop, octave_sort< T >::ms, and result.
void octave_sort< T >::nth_element | ( | T * | data, |
octave_idx_type | nel, | ||
octave_idx_type | lo, | ||
octave_idx_type | up = -1 |
||
) |
Definition at line 1933 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, and octave_sort< T >::descending_compare().
Referenced by Array< octave_value >::nth_element().
|
private |
Definition at line 1907 of file oct-sort.cc.
References swap.
|
delete |
|
inline |
Definition at line 128 of file oct-sort.h.
Referenced by Array< octave_value >::is_sorted_rows(), Array< octave_value >::issorted(), Array< octave_value >::lookup(), Array< octave_value >::nth_element(), Sparse< bool >::sort(), Array< octave_value >::sort(), idx_vector::idx_vector_rep::sort_idx(), and idx_vector::idx_vector_rep::sort_uniq_clone().
void octave_sort< T >::set_compare | ( | sortmode | mode | ) |
Definition at line 137 of file oct-sort.cc.
References ASCENDING, DESCENDING, and mode.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type | nel, | ||
std::less< bool > | |||
) |
Definition at line 85 of file Array-b.cc.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type | nel, | ||
std::greater< bool > | |||
) |
Definition at line 94 of file Array-b.cc.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | nel, | ||
std::less< bool > | |||
) |
Definition at line 103 of file Array-b.cc.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | nel, | ||
std::greater< bool > | |||
) |
Definition at line 112 of file Array-b.cc.
void octave_sort< T >::sort | ( | T * | data, |
octave_idx_type | nel | ||
) |
Definition at line 1506 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, and octave_sort< T >::descending_compare().
Referenced by dmsolve_extract(), dmsolve_insert(), string_vector::sort(), octave_sort< T >::sort(), Sparse< bool >::sort(), Array< octave_value >::sort(), idx_vector::idx_vector_rep::sort_idx(), octave_sort< T >::sort_rows(), and idx_vector::idx_vector_rep::sort_uniq_clone().
void octave_sort< T >::sort | ( | T * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | nel | ||
) |
Definition at line 1524 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, octave_sort< T >::descending_compare(), and octave_sort< T >::sort().
|
private |
Definition at line 1391 of file oct-sort.cc.
References octave_sort< T >::s_slice::base, octave_sort< T >::binarysort(), octave_sort< T >::count_run(), octave_sort< T >::MergeState::getmem(), octave_sort< T >::s_slice::len, MAX_MERGE_PENDING, octave_sort< T >::merge_collapse(), octave_sort< T >::merge_compute_minrun(), octave_sort< T >::merge_force_collapse(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, octave_sort< T >::MergeState::pending, and octave_sort< T >::MergeState::reset().
|
private |
Definition at line 1447 of file oct-sort.cc.
References octave_sort< T >::s_slice::base, octave_sort< T >::binarysort(), octave_sort< T >::count_run(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::s_slice::len, MAX_MERGE_PENDING, octave_sort< T >::merge_collapse(), octave_sort< T >::merge_compute_minrun(), octave_sort< T >::merge_force_collapse(), octave_sort< T >::ms, octave_sort< T >::MergeState::n, octave_sort< T >::MergeState::pending, and octave_sort< T >::MergeState::reset().
void octave_sort< T >::sort_rows | ( | const T * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | rows, | ||
octave_idx_type | cols | ||
) |
Definition at line 1650 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::compare, and octave_sort< T >::descending_compare().
Referenced by Array< octave_value >::sort_rows_idx().
|
private |
Definition at line 1593 of file oct-sort.cc.
References i, OCTAVE_LOCAL_BUFFER, and octave_sort< T >::sort().
|
private |
Definition at line 241 of file oct-sort.h.
Referenced by octave_sort< T >::is_sorted_rows(), octave_sort< T >::issorted(), octave_sort< T >::lookup(), octave_sort< T >::lookup_sorted(), octave_sort< T >::nth_element(), octave_sort< T >::sort(), and octave_sort< T >::sort_rows().
|
private |
Definition at line 243 of file oct-sort.h.
Referenced by octave_sort< T >::merge_at(), octave_sort< T >::merge_collapse(), octave_sort< T >::merge_force_collapse(), octave_sort< T >::merge_hi(), octave_sort< T >::merge_lo(), and octave_sort< T >::sort().