Mercurial > hg > octave-lyh
changeset 10493:2f8bacc2a57d
fix order of func defs in Sparse.cc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 07 Apr 2010 12:07:06 +0200 |
parents | a6b64a7a3769 |
children | e52f41fd82c7 |
files | liboctave/ChangeLog liboctave/Sparse.cc |
diffstat | 2 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2010-04-07 Jaroslav Hajek <highegg@gmail.com> + + * Sparse.cc (lblookup): Move in front of Sparse<T>::delete_elements. + 2010-04-07 Jaroslav Hajek <highegg@gmail.com> * str-vec.h (string_vector::string_vector (const Array<std::string>)):
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -1217,6 +1217,25 @@ } } +// Lower bound lookup. Could also use octave_sort, but that has upper bound +// semantics, so requires some manipulation to set right. Uses a plain loop for +// small columns. +static octave_idx_type +lblookup (const octave_idx_type *ridx, octave_idx_type nr, + octave_idx_type ri) +{ + if (nr <= 8) + { + octave_idx_type l; + for (l = 0; l < nr; l++) + if (ridx[l] >= ri) + break; + return l; + } + else + return std::lower_bound (ridx, ridx + nr, ri) - ridx; +} + template <class T> void Sparse<T>::delete_elements (const idx_vector& idx) @@ -1429,25 +1448,6 @@ return retval; } -// Lower bound lookup. Could also use octave_sort, but that has upper bound -// semantics, so requires some manipulation to set right. Uses a plain loop for -// small columns. -static octave_idx_type -lblookup (const octave_idx_type *ridx, octave_idx_type nr, - octave_idx_type ri) -{ - if (nr <= 8) - { - octave_idx_type l; - for (l = 0; l < nr; l++) - if (ridx[l] >= ri) - break; - return l; - } - else - return std::lower_bound (ridx, ridx + nr, ri) - ridx; -} - template <class T> Sparse<T> Sparse<T>::index (const idx_vector& idx, bool resize_ok) const