Mercurial > hg > octave-lyh
diff liboctave/oct-sort.h @ 9341:9fd5c56ce57a
extend lookup capabilities
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 12 Jun 2009 16:01:53 +0200 |
parents | eb63fbe60fab |
children | 2ebf3ca62add |
line wrap: on
line diff
--- a/liboctave/oct-sort.h +++ b/liboctave/oct-sort.h @@ -148,6 +148,17 @@ const T* values, octave_idx_type nvalues, octave_idx_type *idx, octave_idx_type offset = 0); + // Lookup an array of values, only returning indices of + // exact matches. Non-matches are returned as -1. + void lookupm (const T *data, octave_idx_type nel, + const T* values, octave_idx_type nvalues, + octave_idx_type *idx); + + // Lookup an array of values, only indicating exact matches. + void lookupb (const T *data, octave_idx_type nel, + const T* values, octave_idx_type nvalues, + bool *match); + static bool ascending_compare (typename ref_param<T>::type, typename ref_param<T>::type); @@ -302,6 +313,15 @@ const T* values, octave_idx_type nvalues, octave_idx_type *idx, octave_idx_type offset, Comp comp); + template <class Comp> + void lookupm (const T *data, octave_idx_type nel, + const T* values, octave_idx_type nvalues, + octave_idx_type *idx, Comp comp); + + template <class Comp> + void lookupb (const T *data, octave_idx_type nel, + const T* values, octave_idx_type nvalues, + bool *match, Comp comp); }; template <class T>