Mercurial > hg > octave-avbm
changeset 1274:305162358727
[project @ 1995-04-21 19:38:45 by jwe]
author | jwe |
---|---|
date | Fri, 21 Apr 1995 19:38:45 +0000 |
parents | fd3ed8834b77 |
children | d607adf5af66 |
files | src/tc-rep-ass.cc |
diffstat | 1 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tc-rep-ass.cc +++ b/src/tc-rep-ass.cc @@ -620,8 +620,7 @@ int nr = rows (); int nc = columns (); - assert ((nr == 1 || nc == 1 || (nr == 0 && nc == 0)) - && ! user_pref.do_fortran_indexing); + assert ((nr <= 1 || nc <= 1) && ! user_pref.do_fortran_indexing); tree_constant tmp_i = i_arg.make_numeric_or_range_or_magic (); @@ -773,13 +772,17 @@ int len = MAX (nr, nc); - if (i < 0 || i >= len) + if (i < 0 || i >= len || (nr == 0 && nc == 0)) { ::error ("A(int) = []: index out of range"); return; } - if (nr == 1) + if (nr == 0 && nc > 0) + resize (0, nc - 1); + else if (nc == 0 && nr > 0) + resize (nr - 1, 0); + else if (nr == 1) delete_column (i); else if (nc == 1) delete_row (i); @@ -2177,6 +2180,9 @@ iv.sort_uniq (); int num_to_delete = iv.length (); + if (num_to_delete == 0) + return; + int nr = rows (); int nc = columns (); @@ -2238,6 +2244,9 @@ ri.sort (); int num_to_delete = ri.nelem (); + if (num_to_delete == 0) + return; + int nr = rows (); int nc = columns (); @@ -2353,6 +2362,9 @@ jv.sort_uniq (); int num_to_delete = jv.length (); + if (num_to_delete == 0) + return; + int nr = rows (); int nc = columns (); @@ -2414,6 +2426,9 @@ rj.sort (); int num_to_delete = rj.nelem (); + if (num_to_delete == 0) + return; + int nr = rows (); int nc = columns ();