# HG changeset patch # User jwe # Date 1074729669 0 # Node ID 72c28fd651c4966307e99d50957b15ebb7be60cc # Parent 4d2e1623c9a9c0b013f4f8d21404b9b61c508142 [project @ 2004-01-22 00:01:09 by jwe] diff -r 4d2e1623c9a9 -r 72c28fd651c4 liboctave/Array.cc --- a/liboctave/Array.cc Wed Jan 21 20:10:25 2004 +0000 +++ b/liboctave/Array.cc Thu Jan 22 00:01:09 2004 +0000 @@ -2737,7 +2737,7 @@ for (int j = 0; j < idx_is_colon.length (); j++) { - if (rhs_dims(jj) == 1) + if (jj < rhs_dims.length () && rhs_dims(jj) == 1) jj++; else if (idx_is_colon(j)) { @@ -2869,6 +2869,8 @@ retval = 0; } + lhs.chop_trailing_singletons (); + lhs.clear_index (); return retval; diff -r 4d2e1623c9a9 -r 72c28fd651c4 liboctave/Array.h --- a/liboctave/Array.h Wed Jan 21 20:10:25 2004 +0000 +++ b/liboctave/Array.h Thu Jan 22 00:01:09 2004 +0000 @@ -248,7 +248,10 @@ dim_vector dims (void) const { return dimensions; } Array squeeze (void) const; - + + void chop_trailing_singletons (void) + { dimensions.chop_trailing_singletons (); } + static int get_size (int r, int c); static int get_size (int r, int c, int p); static int get_size (const dim_vector& dv); diff -r 4d2e1623c9a9 -r 72c28fd651c4 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Jan 21 20:10:25 2004 +0000 +++ b/liboctave/ChangeLog Thu Jan 22 00:01:09 2004 +0000 @@ -1,10 +1,12 @@ 2004-01-21 Petter Risholm - * Array.cc (Array::assignN(Array&, const Array&, - const LT&)): Fix incorrectly nested if statement. + * Array.h (Array::chop_trailing_singletons): New function. + * Array.cc (Array::assignN): Use it on LHS. + + * Array.cc (Array::assignN): Fix incorrectly nested if statement. Retrieve scalar element by passin 0 instead of an index array. - Check for singleton dimensions where RHS is matrix or higher - dimension. + Check for singleton dimensions where RHS is matrix or higher dimension. + Make sure index is in bounds. 2004-01-19 John W. Eaton