Mercurial > hg > octave-nkf
changeset 4828:e78bc84ac0d3
[project @ 2004-03-09 22:36:55 by jwe]
author | jwe |
---|---|
date | Tue, 09 Mar 2004 22:36:55 +0000 |
parents | bb82599f039f |
children | 71dade3c16b6 |
files | liboctave/Array.cc liboctave/ChangeLog |
diffstat | 2 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1987,10 +1987,12 @@ { Array<T> tmp = Array<T>::index1 (idx_arg, resize_ok); - if (tmp.length () != 0) + int len = tmp.length (); + + if (len == 0 && idx_arg.one_zero_only ()) + retval = Array<T> (tmp, dim_vector (0, 0)); + else retval = Array<T> (tmp, dim_vector (idx_orig_rows, idx_orig_columns)); - else - retval = Array<T> (tmp, dim_vector (0, 0)); } else if (nr == 1 || nc == 1) { @@ -1998,7 +2000,7 @@ // shape as the index. Otherwise, it has same orientation as // indexed object. - Array<T> tmp = index1 (idx_arg, resize_ok); + Array<T> tmp = Array<T>::index1 (idx_arg, resize_ok); int len = tmp.length ();
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,8 @@ 2004-03-09 John W. Eaton <jwe@bevo.che.wisc.edu> + * Array.cc (Array<T>::index2): If scalar or vector is indexed by + matrix, return object that is the same size as the index. + * mx-op-defs.h (NDND_CMP_OP, MM_CMP_OP): Require dimensions to agree. Eliminate MT_RESULT args. Return value is always size of args. (MS_CMP_OP, SM_CMP_OP, NDS_CMP_OP, SND_CMP_OP):