Mercurial > hg > octave-lyh
diff liboctave/oct-sort.h @ 9725:aea3a3a950e1
implement nth_element
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 14 Oct 2009 13:23:31 +0200 |
parents | 0951174cbb03 |
children | 7c8392a034e6 |
line wrap: on
line diff
--- a/liboctave/oct-sort.h +++ b/liboctave/oct-sort.h @@ -159,6 +159,11 @@ const T* values, octave_idx_type nvalues, bool *match); + // Rearranges the array so that the elements with indices + // lo..up-1 are in their correct place. + void nth_element (T *data, octave_idx_type nel, + octave_idx_type lo, octave_idx_type up = -1); + static bool ascending_compare (typename ref_param<T>::type, typename ref_param<T>::type); @@ -322,6 +327,11 @@ void lookupb (const T *data, octave_idx_type nel, const T* values, octave_idx_type nvalues, bool *match, Comp comp); + + template <class Comp> + void nth_element (T *data, octave_idx_type nel, + octave_idx_type lo, octave_idx_type up, + Comp comp); }; template <class T>