Mercurial > hg > octave-nkf
changeset 4703:72c28fd651c4
[project @ 2004-01-22 00:01:09 by jwe]
author | jwe |
---|---|
date | Thu, 22 Jan 2004 00:01:09 +0000 |
parents | 4d2e1623c9a9 |
children | e1b71baef20c |
files | liboctave/Array.cc liboctave/Array.h liboctave/ChangeLog |
diffstat | 3 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -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;
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -248,7 +248,10 @@ dim_vector dims (void) const { return dimensions; } Array<T> 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);
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,10 +1,12 @@ 2004-01-21 Petter Risholm <risholm@stud.ntnu.no> - * Array.cc (Array<T>::assignN(Array<LT>&, const Array<RT>&, - const LT&)): Fix incorrectly nested if statement. + * Array.h (Array<T>::chop_trailing_singletons): New function. + * Array.cc (Array<T>::assignN): Use it on LHS. + + * Array.cc (Array<T>::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 <jwe@bevo.che.wisc.edu>