Mercurial > hg > octave-lojdl
changeset 9544:df0abc63c230
cache/use cached index vector on full find in logical masks
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 19 Aug 2009 07:55:31 +0200 |
parents | 1d51ab34b509 |
children | 8670e55078fd |
files | src/ChangeLog src/DLD-FUNCTIONS/find.cc |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-08-19 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/find.cc (Ffind): Reuse cached index vector when + converting boolean mask to indices. + 2009-08-18 John W. Eaton <jwe@octave.org> * oct-conf.h.in: New #defines for HDF5_LDFLAGS and HDF5LDFLAGS.
--- a/src/DLD-FUNCTIONS/find.cc +++ b/src/DLD-FUNCTIONS/find.cc @@ -480,6 +480,12 @@ retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); } + else if (nargout <= 1 && n_to_find == -1 && direction == 1) + { + // This case is equivalent to extracting indices from a logical + // matrix. Try to reuse the possibly cached index vector. + retval(0) = arg.index_vector (); + } else { boolNDArray v = arg.bool_array_value ();