changeset 10113:5aff7f14aa7f

fix concatenation bug
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 14 Jan 2010 22:39:17 +0100
parents fddfebeeb33a
children e4936c129cbd
files liboctave/Array.cc liboctave/ChangeLog
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc	Thu Jan 14 16:15:53 2010 -0500
+++ b/liboctave/Array.cc	Thu Jan 14 22:39:17 2010 +0100
@@ -1593,17 +1593,17 @@
 {
   octave_idx_type n = ra_idx.length ();
 
-  if (n == dimensions.length ())
+  if (n >= dimensions.length ())
     {
-      dim_vector dva = a.dims ();
-      dim_vector dv = dims ();
+      const dim_vector dva = a.dims ();
+      const dim_vector dv = dims ().redim (n);
       int len_a = dva.length ();
       int non_full_dim = 0;
 
       for (octave_idx_type i = 0; i < n; i++)
 	{
 	  if (ra_idx(i) < 0 || (ra_idx(i) + 
-				(i < len_a ? dva(i) : 1)) > dimensions(i))
+				(i < len_a ? dva(i) : 1)) > dv(i))
 	    {
 	      (*current_liboctave_error_handler)
 		("Array<T>::insert: range error for insert");
--- a/liboctave/ChangeLog	Thu Jan 14 16:15:53 2010 -0500
+++ b/liboctave/ChangeLog	Thu Jan 14 22:39:17 2010 +0100
@@ -1,3 +1,8 @@
+2010-01-14  Jaroslav Hajek  <highegg@gmail.com>
+
+	* Array.cc (Array<T>::insert (const Array<T>&, const
+	Array<octave_idx_type>&): Allow less dimensions than indices.
+
 2010-01-14  Jaroslav Hajek  <highegg@gmail.com>
 
 	* chNDArray.h: Declare relational bsxfun ops.