Mercurial > hg > octave-lojdl
changeset 4534:e8355721a809
[project @ 2003-10-16 02:31:56 by jwe]
author | jwe |
---|---|
date | Thu, 16 Oct 2003 02:31:56 +0000 |
parents | ed2990fab58f |
children | a5f23212a3d8 |
files | liboctave/Array.cc liboctave/ChangeLog |
diffstat | 2 files changed, 21 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2151,19 +2151,25 @@ } else { - if (rhs_nr == 1 && rhs_nc == 1 && n > 0 && m > 0) + if (rhs_nr == 1 && rhs_nc == 1 && n >= 0 && m >= 0) { - MAYBE_RESIZE_LHS; - - RT scalar = rhs.elem (0, 0); - - for (int j = 0; j < m; j++) + // No need to do anything if either of the indices + // are empty. + + if (n > 0 && m > 0) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + MAYBE_RESIZE_LHS; + + RT scalar = rhs.elem (0, 0); + + for (int j = 0; j < m; j++) { - int ii = idx_i.elem (i); - lhs.elem (ii, jj) = scalar; + int jj = idx_j.elem (j); + for (int i = 0; i < n; i++) + { + int ii = idx_i.elem (i); + lhs.elem (ii, jj) = scalar; + } } } }
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2003-10-15 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array.cc (assign2): No error (but don't do anything either) for + expressions like x([],j) = scalar. + 2003-10-09 John W. Eaton <jwe@bevo.che.wisc.edu> * Array.cc (assignN): Allow lhs(:) = scalar.