# HG changeset patch # User David Bateman # Date 1205869153 14400 # Node ID 6b2a99e44ff2a95186da61edf025a7477d3c4e0b # Parent 6929e40fc5979c87b5e3061c97e25008e3a94822 shortened empty indexing fix diff --git a/liboctave/Array.cc b/liboctave/Array.cc --- 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 { diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-03-18 David Bateman + + * Array.cc (Array::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 * oct-inttypes.h (OCTAVE_DBL_FTR): New macro. diff --git a/test/test_index-wfi-f.m b/test/test_index-wfi-f.m --- 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");