# HG changeset patch # User Jaroslav Hajek # Date 1250661331 -7200 # Node ID df0abc63c2301bc1d06dcd14b739527c6a8c61a6 # Parent 1d51ab34b509346be849374d3ccc664ed40470c5 cache/use cached index vector on full find in logical masks diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-08-19 Jaroslav Hajek + + * DLD-FUNCTIONS/find.cc (Ffind): Reuse cached index vector when + converting boolean mask to indices. + 2009-08-18 John W. Eaton * oct-conf.h.in: New #defines for HDF5_LDFLAGS and HDF5LDFLAGS. diff --git a/src/DLD-FUNCTIONS/find.cc b/src/DLD-FUNCTIONS/find.cc --- 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 ();