comparison src/DLD-FUNCTIONS/find.cc @ 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 e2344f4af0cb
children b4fdfee405b5
comparison
equal deleted inserted replaced
9543:1d51ab34b509 9544:df0abc63c230
478 478
479 if (! error_state) 479 if (! error_state)
480 retval = find_nonzero_elem_idx (v, nargout, 480 retval = find_nonzero_elem_idx (v, nargout,
481 n_to_find, direction); 481 n_to_find, direction);
482 } 482 }
483 else if (nargout <= 1 && n_to_find == -1 && direction == 1)
484 {
485 // This case is equivalent to extracting indices from a logical
486 // matrix. Try to reuse the possibly cached index vector.
487 retval(0) = arg.index_vector ();
488 }
483 else 489 else
484 { 490 {
485 boolNDArray v = arg.bool_array_value (); 491 boolNDArray v = arg.bool_array_value ();
486 492
487 if (! error_state) 493 if (! error_state)