# HG changeset patch # User jwe # Date 1075920003 0 # Node ID 80156474b068eb09cf420d3a62ad6e4f708e9d46 # Parent b484cdca27be4ab9b964484e7b35aff09245b93e [project @ 2004-02-04 18:40:03 by jwe] diff -r b484cdca27be -r 80156474b068 liboctave/Array.cc --- a/liboctave/Array.cc Wed Feb 04 04:32:48 2004 +0000 +++ b/liboctave/Array.cc Wed Feb 04 18:40:03 2004 +0000 @@ -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 diff -r b484cdca27be -r 80156474b068 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Feb 04 04:32:48 2004 +0000 +++ b/liboctave/ChangeLog Wed Feb 04 18:40:03 2004 +0000 @@ -1,3 +1,8 @@ +2004-02-04 John W. Eaton + + * Array.cc (Array::assignN): Simplify dimension check by + comparing rhs_dims and frozen_len sans trailing singletons. + 2004-02-03 John W. Eaton * idx-vector.cc (tree_to_mat_idx): New arg, conversion_error.