#include "oct-sort.h"
Classes | |
struct | MergeState |
struct | s_slice |
Public Types | |
typedef std::function< bool(typename ref_param< T >::type, typename ref_param< T >::type)> | compare_fcn_type |
Public Member Functions | |
octave_sort (const compare_fcn_type &) | |
octave_sort (const octave_sort &)=delete | |
octave_sort (void) | |
~octave_sort (void) | |
bool | is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols) |
bool | issorted (const T *data, octave_idx_type nel) |
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) |
octave_sort & | operator= (const octave_sort &)=delete |
void | set_compare (const compare_fcn_type &comp) |
void | set_compare (sortmode mode) |
void | sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::greater< bool >) |
void | sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::less< bool >) |
void | sort (bool *data, octave_idx_type nel, std::greater< bool >) |
void | sort (bool *data, octave_idx_type nel, std::less< bool >) |
void | sort (T *data, octave_idx_type *idx, octave_idx_type nel) |
void | sort (T *data, octave_idx_type nel) |
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 | |
template<typename Comp > | |
void | binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, octave_idx_type start, Comp comp) |
template<typename Comp > | |
void | binarysort (T *data, 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_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 *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, 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_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 > | |
int | merge_lo (T *pa, octave_idx_type na, T *pb, 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 *idx, octave_idx_type nel, Comp comp) |
template<typename Comp > | |
void | sort (T *data, 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 | m_compare |
MergeState * | m_ms |
Static Private Attributes | |
static const int | MAX_MERGE_PENDING = 85 |
static const int | MERGESTATE_TEMP_SIZE = 1024 |
static const int | MIN_GALLOP = 7 |
Definition at line 100 of file oct-sort.h.
typedef std::function<bool (typename ref_param<T>::type, typename ref_param<T>::type)> octave_sort< T >::compare_fcn_type |
Definition at line 107 of file oct-sort.h.
octave_sort< T >::octave_sort | ( | void | ) |
Definition at line 122 of file oct-sort.cc.
octave_sort< T >::octave_sort | ( | const compare_fcn_type & | comp | ) |
Definition at line 127 of file oct-sort.cc.
|
delete |
octave_sort< T >::~octave_sort | ( | void | ) |
Definition at line 132 of file oct-sort.cc.
|
static |
Definition at line 1967 of file oct-sort.cc.
References x.
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 197 of file oct-sort.cc.
References r.
|
private |
|
private |
|
static |
Definition at line 1975 of file oct-sort.cc.
References x.
Referenced by octave_sort< T >::is_sorted_rows(), octave_sort< T >::issorted(), Array< T, Alloc >::lookup(), 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 324 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 419 of file oct-sort.cc.
Referenced by octave_sort< T >::merge_at(), octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().
bool octave_sort< T >::is_sorted_rows | ( | const T * | data, |
octave_idx_type | rows, | ||
octave_idx_type | cols | ||
) |
Definition at line 1742 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by Array< T, Alloc >::is_sorted_rows().
|
private |
Definition at line 1685 of file oct-sort.cc.
References octave_sort< T >::issorted(), and n.
bool octave_sort< T >::issorted | ( | const T * | data, |
octave_idx_type | nel | ||
) |
Definition at line 1577 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by octave_sort< T >::is_sorted_rows(), and Array< T, Alloc >::issorted().
|
private |
Definition at line 1557 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 1787 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by Array< T, Alloc >::lookup(), and octave_sort< T >::lookup().
|
private |
Definition at line 1767 of file oct-sort.cc.
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 1823 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), octave_sort< T >::lookup(), and octave_sort< T >::m_compare.
|
private |
Definition at line 1810 of file oct-sort.cc.
References octave_sort< T >::lookup().
|
private |
Definition at line 1844 of file oct-sort.cc.
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 1898 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by Array< T, Alloc >::lookup().
|
private |
Definition at line 1160 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::s_slice::m_base, octave_sort< T >::s_slice::m_len, octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().
Referenced by octave_sort< T >::merge_collapse(), and octave_sort< T >::merge_force_collapse().
|
private |
Definition at line 1211 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::s_slice::m_base, octave_sort< T >::s_slice::m_len, octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().
|
private |
Definition at line 1275 of file oct-sort.cc.
References octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_at(), and n.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1304 of file oct-sort.cc.
References octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_at(), and n.
|
private |
Definition at line 1385 of file oct-sort.cc.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1338 of file oct-sort.cc.
References octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_at(), and n.
Referenced by octave_sort< T >::sort().
|
private |
Definition at line 1357 of file oct-sort.cc.
References octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::merge_at(), and n.
|
private |
Definition at line 1010 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::MergeState::m_a, octave_sort< T >::MergeState::m_ia, octave_sort< T >::MergeState::m_min_gallop, octave_sort< T >::m_ms, and octave_sort< T >::MIN_GALLOP.
|
private |
Definition at line 873 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmem(), octave_sort< T >::MergeState::m_a, octave_sort< T >::MergeState::m_min_gallop, octave_sort< T >::m_ms, and octave_sort< T >::MIN_GALLOP.
Referenced by octave_sort< T >::merge_at().
|
private |
Definition at line 726 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::MergeState::m_a, octave_sort< T >::MergeState::m_ia, octave_sort< T >::MergeState::m_min_gallop, octave_sort< T >::m_ms, and octave_sort< T >::MIN_GALLOP.
|
private |
Definition at line 591 of file oct-sort.cc.
References octave_sort< T >::gallop_left(), octave_sort< T >::gallop_right(), octave_sort< T >::MergeState::getmem(), octave_sort< T >::MergeState::m_a, octave_sort< T >::MergeState::m_min_gallop, octave_sort< T >::m_ms, and octave_sort< T >::MIN_GALLOP.
Referenced by octave_sort< T >::merge_at().
|
private |
Definition at line 1919 of file oct-sort.cc.
void octave_sort< T >::nth_element | ( | T * | data, |
octave_idx_type | nel, | ||
octave_idx_type | lo, | ||
octave_idx_type | up = -1 |
||
) |
Definition at line 1945 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by Array< T, Alloc >::nth_element().
|
delete |
|
inline |
Definition at line 121 of file oct-sort.h.
Referenced by Array< T, Alloc >::is_sorted_rows(), Array< T, Alloc >::issorted(), Array< T, Alloc >::lookup(), Array< T, Alloc >::nth_element(), Array< T, Alloc >::sort(), Sparse< T, Alloc >::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 139 of file oct-sort.cc.
References ASCENDING, and DESCENDING.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | nel, | ||
std::greater< bool > | |||
) |
Definition at line 116 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 107 of file Array-b.cc.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type | nel, | ||
std::greater< bool > | |||
) |
Definition at line 98 of file Array-b.cc.
void octave_sort< bool >::sort | ( | bool * | data, |
octave_idx_type | nel, | ||
std::less< bool > | |||
) |
Definition at line 89 of file Array-b.cc.
void octave_sort< T >::sort | ( | T * | data, |
octave_idx_type * | idx, | ||
octave_idx_type | nel | ||
) |
Definition at line 1538 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), octave_sort< T >::m_compare, and octave_sort< T >::sort().
|
private |
Definition at line 1457 of file oct-sort.cc.
References octave_sort< T >::binarysort(), octave_sort< T >::count_run(), octave_sort< T >::MergeState::getmemi(), octave_sort< T >::s_slice::m_base, octave_sort< T >::s_slice::m_len, octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::MAX_MERGE_PENDING, octave_sort< T >::merge_collapse(), octave_sort< T >::merge_compute_minrun(), octave_sort< T >::merge_force_collapse(), octave_sort< T >::MERGESTATE_TEMP_SIZE, n, and octave_sort< T >::MergeState::reset().
void octave_sort< T >::sort | ( | T * | data, |
octave_idx_type | nel | ||
) |
Definition at line 1520 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by dmsolve_extract(), dmsolve_insert(), dmsolve_permute(), octinternal_do_mul_colpm_sm(), string_vector::sort(), Array< T, Alloc >::sort(), Sparse< T, Alloc >::sort(), octave_sort< T >::sort(), idx_vector::idx_vector_rep::sort_idx(), octave_sort< T >::sort_rows(), and idx_vector::idx_vector_rep::sort_uniq_clone().
|
private |
Definition at line 1401 of file oct-sort.cc.
References octave_sort< T >::binarysort(), octave_sort< T >::count_run(), octave_sort< T >::MergeState::getmem(), octave_sort< T >::s_slice::m_base, octave_sort< T >::s_slice::m_len, octave_sort< T >::m_ms, octave_sort< T >::MergeState::m_n, octave_sort< T >::MergeState::m_pending, octave_sort< T >::MAX_MERGE_PENDING, octave_sort< T >::merge_collapse(), octave_sort< T >::merge_compute_minrun(), octave_sort< T >::merge_force_collapse(), octave_sort< T >::MERGESTATE_TEMP_SIZE, n, 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 1665 of file oct-sort.cc.
References octave_sort< T >::ascending_compare(), octave_sort< T >::descending_compare(), and octave_sort< T >::m_compare.
Referenced by Array< T, Alloc >::sort_rows_idx().
|
private |
Definition at line 1608 of file oct-sort.cc.
References OCTAVE_LOCAL_BUFFER, and octave_sort< T >::sort().
|
private |
Definition at line 247 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 249 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().
|
staticprivate |
Definition at line 176 of file oct-sort.h.
Referenced by octave_sort< T >::sort().
|
staticprivate |
Definition at line 183 of file oct-sort.h.
Referenced by octave_sort< T >::sort().
|
staticprivate |
Definition at line 180 of file oct-sort.h.
Referenced by octave_sort< T >::merge_hi(), and octave_sort< T >::merge_lo().