Mercurial > hg > octave-nkf
changeset 11698:abe3831a5fc1 release-3-0-x
shortened empty indexing fix
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 18 Mar 2008 15:39:43 -0400 |
parents | ca0e5cfe59d1 |
children | 1e9ce581998e |
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 @@ -2392,7 +2392,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");