changeset 4553:c7eb767505e9

[project @ 2003-10-27 21:39:55 by jwe]
author jwe
date Mon, 27 Oct 2003 21:39:55 +0000
parents 6f3382e08a52
children 78e34346f6fd
files liboctave/Array.cc liboctave/ChangeLog
diffstat 2 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc	Mon Oct 27 20:38:03 2003 +0000
+++ b/liboctave/Array.cc	Mon Oct 27 21:39:55 2003 +0000
@@ -700,18 +700,25 @@
 	}
     }
 
-  bool no_change = true;
-
-  for (int i = 0; i < n; i++)
+  bool same_size = true;
+
+  if (dimensions.length () != n)
+    {
+      same_size = false;
+    }
+  else
     {
-      if (dims(i) != dimensions(i))
+      for (int i = 0; i < n; i++)
 	{
-	  no_change = false;
-	  break;
+	  if (dims(i) != dimensions(i))
+	    {
+	      same_size = false;
+	      break;
+	    }
 	}
     }
 
-  if (no_change)
+  if (same_size)
     return;
 
   typename Array<T>::ArrayRep *old_rep = rep;
--- a/liboctave/ChangeLog	Mon Oct 27 20:38:03 2003 +0000
+++ b/liboctave/ChangeLog	Mon Oct 27 21:39:55 2003 +0000
@@ -1,5 +1,8 @@
 2003-10-27  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* Array.cc (Array<T>::resize_and_fill): Allow number of dimensions
+	to change.  From Petter Risholm  <risholm@stud.ntnu.no>.
+
 	* oct-rand.cc, CColVector.cc, CMatrix.cc, CRowVector.cc,
 	CmplxAEPBAL.cc CmplxCHOL.cc, CmplxHESS.cc, CmplxLU.cc, CmplxQR.cc,
 	CmplxQRP.cc, CmplxSCHUR.cc, CmplxSVD.cc, CollocWt.cc, DASPK.cc,