# HG changeset patch # User jwe # Date 1159306696 0 # Node ID b4351cfb56592acba0835a8b377125a7b1c32906 # Parent 01556febbaaf551ae7fb4c1658bbeba22014e6bb [project @ 2006-09-26 21:38:16 by jwe] diff -r 01556febbaaf -r b4351cfb5659 src/DLD-FUNCTIONS/find.cc --- a/src/DLD-FUNCTIONS/find.cc Tue Sep 26 21:16:52 2006 +0000 +++ b/src/DLD-FUNCTIONS/find.cc Tue Sep 26 21:38:16 2006 +0000 @@ -118,6 +118,10 @@ // Search for elements to return. Only search the region where // there are elements to be found using the count that we want // to find. + + // For compatibility, all N-d arrays are handled as if they are + // 2-d, with the number of columns equal to "prod (dims (2:end))". + for (k = start_el; k < end_el; k++) { OCTAVE_QUIT; @@ -126,8 +130,9 @@ { idx(count) = k + 1; - i_idx(count) = i + 1; - j_idx(count) = j + 1; + octave_idx_type xr = k % nr; + i_idx(count) = xr + 1; + j_idx(count) = (k - xr) / nr + 1; val(count) = nda(k); @@ -135,13 +140,6 @@ } i++; - - if (i == nr) - { - i = 0; - - j++; - } } } else if (scalar_arg) diff -r 01556febbaaf -r b4351cfb5659 test/test_matrix.m --- a/test/test_matrix.m Tue Sep 26 21:16:52 2006 +0000 +++ b/test/test_matrix.m Tue Sep 26 21:38:16 2006 +0000 @@ -63,9 +63,6 @@ %% test/octave.test/matrix/find-3.m %!error find (); -%% test/octave.test/matrix/find-4.m -%!error find (1, 2); - %% test/octave.test/matrix/fliplr-1.m %!assert((fliplr ([1, 2; 3, 4]) == [2, 1; 4, 3] %! && fliplr ([1, 2; 3, 4; 5, 6]) == [2, 1; 4, 3; 6, 5]