Mercurial > hg > octave-nkf
diff liboctave/Array.h @ 9725:aea3a3a950e1
implement nth_element
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 14 Oct 2009 13:23:31 +0200 |
parents | e087d7c77ff9 |
children | 7b9cbaad68d6 |
line wrap: on
line diff
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -595,8 +595,8 @@ // You should not use it anywhere else. void *mex_get_data (void) const { return const_cast<T *> (data ()); } - Array<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const; - Array<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, + Array<T> sort (int dim = 0, sortmode mode = ASCENDING) const; + Array<T> sort (Array<octave_idx_type> &sidx, int dim = 0, sortmode mode = ASCENDING) const; // Ordering is auto-detected or can be specified. @@ -631,6 +631,10 @@ // specifies search from backward. Array<octave_idx_type> find (octave_idx_type n = -1, bool backward = false) const; + // Returns the n-th element in increasing order, using the same ordering as + // used for sort. n can either be a scalar index or a contiguous range. + Array<T> nth_element (const idx_vector& n, int dim = 0) const; + Array<T> diag (octave_idx_type k = 0) const; template <class U, class F>