Mercurial > hg > octave-lyh
changeset 4322:0b24abe1ba0b
[project @ 2003-02-14 01:58:12 by jwe]
author | jwe |
---|---|
date | Fri, 14 Feb 2003 01:58:12 +0000 |
parents | 8460c03f3b4b |
children | 0990c9b77109 |
files | liboctave/Array2-idx.h liboctave/ChangeLog |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array2-idx.h +++ b/liboctave/Array2-idx.h @@ -89,20 +89,27 @@ } else if (nr == 1 || nc == 1) { - int result_is_column_vector = (nc == 1); + // If indexing a vector with a matrix, return value has same + // shape as the index. Otherwise, it has same orientation as + // indexed object. Array<T> tmp = Array<T>::index (idx_arg, resize_ok); int len = tmp.length (); if (len == 0) - retval = Array2<T> (0, 0); + retval = Array2<T> (idx_orig_rows, idx_orig_columns); else { - if (result_is_column_vector) - retval = Array2<T> (tmp, len, 1); + if (idx_orig_rows == 1 || idx_orig_columns == 1) + { + if (nr == 1) + retval = Array2<T> (tmp, 1, len); + else + retval = Array2<T> (tmp, len, 1); + } else - retval = Array2<T> (tmp, 1, len); + retval = Array2<T> (tmp, idx_orig_rows, idx_orig_columns); } } else if (liboctave_dfi_flag
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2003-02-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array2-idx.h (Array2<T>::index (idx_vector&, int, const T&)): + Compatibility fix. + 2003-02-10 John W. Eaton <jwe@bevo.che.wisc.edu> * CColVector.cc (ComplexColumnVector::extract_n): New function.