changeset 9987:bb30843c4929

fix subscripting of vectors by N-d arrays
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 15 Dec 2009 10:05:38 +0100
parents 672e1b49e01e
children 76cf4aec34e9
files liboctave/Array.cc liboctave/ChangeLog
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -767,11 +767,11 @@
       // As you can see, the behaviour is weird, but the tests end up pretty
       // simple.  Nah, I don't want to suggest that this is ad hoc :)
 
-      if (ndims () == 2 && n != 1)
+      if (ndims () == 2 && n != 1 && rd.is_vector ())
         {
-          if (columns () == 1 && rd(0) == 1)
+          if (columns () == 1)
             rd = dim_vector (il, 1);
-          else if (rows () == 1 && rd(1) == 1)
+          else if (rows () == 1)
             rd = dim_vector (1, il);
         }
 
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-15  Jaroslav Hajek  <highegg@gmail.com>
+
+	* Array.cc (Array<T>::index (const idx_vector&)): Fix determining of
+	result dimensions.
+
 2009-12-15  Jaroslav Hajek  <highegg@gmail.com>
 
 	* Range.cc (Range::elem, Range::checkelem, Range::index):