Mercurial > hg > octave-lyh
changeset 7597:6b2a99e44ff2
shortened empty indexing fix
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 18 Mar 2008 15:39:13 -0400 |
parents | 6929e40fc597 |
children | a89b3fa632ee |
files | liboctave/Array.cc liboctave/ChangeLog test/test_index-wfi-f.m |
diffstat | 3 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2363,7 +2363,7 @@ dim_vector new_dims = dims (); dim_vector frozen_lengths; - if (! any_orig_empty (ra_idx) && ra_idx_len < n_dims) + if (!ra_idx (ra_idx_len - 1).orig_empty () && ra_idx_len < n_dims) frozen_lengths = short_freeze (ra_idx, dimensions, resize_ok); else {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-03-18 David Bateman <dbateman@free.fr> + + * Array.cc (Array<T>::index): Don't short_freeze on index with + fewer dimensions than the array only if the last dimension is empty. + 2008-03-18 John W. Eaton <jwe@octave.org> * oct-inttypes.h (OCTAVE_DBL_FTR): New macro.
--- a/test/test_index-wfi-f.m +++ b/test/test_index-wfi-f.m @@ -418,6 +418,8 @@ %! b9 = [1, 2, 5, 6]; %! b10 = zeros (1, 0, 2); %! b11 = zeros (1, 0); +%! b12 = [5; 7]; +%! b13 = zeros (0, 1); %! %! assert(a(:),a1); %! assert(a(1:2), a2); @@ -443,4 +445,9 @@ %! assert(b(1,1:4), b9); %! assert(b(1,[],:), b10); %! assert(b(1,[]), b11); +%! assert (b(:,3), b12); +%! assert (b([1,2],3), b12); +%! assert (b(true(2,1),3), b12); +%! assert (b(false(2,1),3), b13) +%! assert (b([],3), b13) %! warning ("wfi.state", "Octave:fortran-indexing");