# HG changeset patch # User jwe # Date 1078871815 0 # Node ID e78bc84ac0d3f5c8648f0dbacaaabf738ee48008 # Parent bb82599f039faf28a7cf1fc4133638c350d9df24 [project @ 2004-03-09 22:36:55 by jwe] diff -r bb82599f039f -r e78bc84ac0d3 liboctave/Array.cc --- a/liboctave/Array.cc Tue Mar 09 20:50:18 2004 +0000 +++ b/liboctave/Array.cc Tue Mar 09 22:36:55 2004 +0000 @@ -1987,10 +1987,12 @@ { Array tmp = Array::index1 (idx_arg, resize_ok); - if (tmp.length () != 0) + int len = tmp.length (); + + if (len == 0 && idx_arg.one_zero_only ()) + retval = Array (tmp, dim_vector (0, 0)); + else retval = Array (tmp, dim_vector (idx_orig_rows, idx_orig_columns)); - else - retval = Array (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 tmp = index1 (idx_arg, resize_ok); + Array tmp = Array::index1 (idx_arg, resize_ok); int len = tmp.length (); diff -r bb82599f039f -r e78bc84ac0d3 liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Mar 09 20:50:18 2004 +0000 +++ b/liboctave/ChangeLog Tue Mar 09 22:36:55 2004 +0000 @@ -1,5 +1,8 @@ 2004-03-09 John W. Eaton + * Array.cc (Array::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):