Mercurial > hg > octave-lyh
changeset 7326:fcc6d853df9e
[project @ 2007-12-19 21:27:23 by jwe]
author | jwe |
---|---|
date | Wed, 19 Dec 2007 21:27:23 +0000 |
parents | 67aef14de9c2 |
children | 9af6f0a214ee |
files | liboctave/Sparse.cc test/build_sparse_tests.sh |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -1973,8 +1973,7 @@ while (true) { - if (idx_i.elem (inode.i) >= 0 && - idx_i.elem (inode.i) < nr) + if (idx_i.elem (inode.i) < nr) new_nzmx ++; if (inode.next == 0) break; @@ -2010,8 +2009,7 @@ while (true) { - if (idx_i.elem (inode.i) >= 0 && - idx_i.elem (inode.i) < nr) + if (idx_i.elem (inode.i) < nr) { X [inode.i] = data (i); retval.xridx (kk++) = inode.i;
--- a/test/build_sparse_tests.sh +++ b/test/build_sparse_tests.sh @@ -790,6 +790,13 @@ # ======================================================= # sparse selection tests +gen_scalar_select_tests () { + cat >>$TESTS <<EOF +%!assert (sparse(42)([1,1]),sparse([42,42])) +%!assert (sparse(42*1i)([1,1]),sparse([42,42].*1i)) +EOF +} + gen_select_tests() { cat >>$TESTS <<EOF %!test as=sparse(af); @@ -1226,6 +1233,7 @@ %! cidx = ceil(n*rand(1,ceil(rand*n)) EOF fi +gen_scalar_select_tests gen_select_tests echo '%!test af=real(af);' >> $TESTS gen_select_tests