# HG changeset patch # User jwe # Date 1076005500 0 # Node ID 108c9a93196d7650064cac4380b1eee2f51c43b9 # Parent 4179c59d82da797730a77f27a1b295a67ab82ca8 [project @ 2004-02-05 18:25:00 by jwe] diff -r 4179c59d82da -r 108c9a93196d liboctave/Array.cc --- a/liboctave/Array.cc Thu Feb 05 18:04:54 2004 +0000 +++ b/liboctave/Array.cc Thu Feb 05 18:25:00 2004 +0000 @@ -2025,6 +2025,21 @@ int n_dims = dimensions.length (); + // Remove trailing singletons in ra_idx, but leave at least ndims + // elements. + + int ra_idx_len = ra_idx.length (); + + while (ra_idx_len > n_dims) + { + if (ra_idx(ra_idx_len-1) == 1) + ra_idx_len--; + else + break; + } + + ra_idx.resize (ra_idx_len); + if (n_dims < ra_idx.length ()) { (*current_liboctave_error_handler) diff -r 4179c59d82da -r 108c9a93196d liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Feb 05 18:04:54 2004 +0000 +++ b/liboctave/ChangeLog Thu Feb 05 18:25:00 2004 +0000 @@ -2,6 +2,8 @@ * Array.cc (Array::assignN): Require RHS == 0x0 matrix for deleting elements. + (Array::index): Remove trailing singletons in ra_idx, but leave + at least ndims elements. 2004-02-05 Petter Risholm