Mercurial > hg > octave-jordi
changeset 4733:80156474b068
[project @ 2004-02-04 18:40:03 by jwe]
author | jwe |
---|---|
date | Wed, 04 Feb 2004 18:40:03 +0000 |
parents | b484cdca27be |
children | f0939599fb7f |
files | liboctave/Array.cc liboctave/ChangeLog |
diffstat | 2 files changed, 14 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2746,36 +2746,16 @@ { // RHS is matrix or higher dimension. - bool dim_ok = true; - - int jj = 0; - // Check that RHS dimensions are the same length as the - // corresponding LHS dimensions. - - int rhs_dims_len = rhs_dims.length (); - - for (int j = 0; j < idx_is_colon.length (); j++) - { - if (jj < rhs_dims.length () && rhs_dims(jj) == 1) - jj++; - else if (idx_is_colon(j)) - { - if (jj > rhs_dims_len || rhs_dims(jj) < lhs_dims(j)) - { - dim_ok = false; - - break; - } - - jj++; - } - } - - if (jj != rhs_dims_len) - dim_ok = false; - - if (! dim_ok) + // corresponding LHS index dimensions. + + dim_vector t_rhs_dims = rhs_dims; + t_rhs_dims.chop_trailing_singletons (); + + dim_vector t_frozen_len = frozen_len; + t_frozen_len.chop_trailing_singletons (); + + if (t_rhs_dims != t_frozen_len) (*current_liboctave_error_handler) ("subscripted assignment dimension mismatch"); else
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2004-02-04 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array.cc (Array<T>::assignN): Simplify dimension check by + comparing rhs_dims and frozen_len sans trailing singletons. + 2004-02-03 John W. Eaton <jwe@bevo.che.wisc.edu> * idx-vector.cc (tree_to_mat_idx): New arg, conversion_error.