Mercurial > hg > octave-terminal
changeset 9045:ac0a23e9f5c5
more compatible indexing by logical empty matrices
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 27 Mar 2009 07:28:13 +0100 |
parents | 656ad518f385 |
children | 88bf56bbccca |
files | liboctave/ChangeLog liboctave/idx-vector.cc |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-03-27 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.cc (idx_vector::idx_vector_rep::idx_vector_rep (const + Array<bool>&): Use more M*b-compatible behaviour. + 2009-03-26 Jaroslav Hajek <highegg@gmail.com> * dim-vector.h (dim_vector::numel): Add optional argument, simplify.
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -295,10 +295,11 @@ for (octave_idx_type i = 0, l = bnda.numel (); i < l; i++) if (bnda.xelem (i)) len++; - dim_vector dv = bnda.dims (); + const dim_vector dv = bnda.dims (); - orig_dims = ((dv.length () == 2 && dv(0) == 1) - ? dim_vector (1, len) : orig_dims = dim_vector (len, 1)); + if (! dv.all_zero ()) + orig_dims = ((dv.length () == 2 && dv(0) == 1) + ? dim_vector (1, len) : dim_vector (len, 1)); if (len != 0) {