changeset 3492:17261f602206

[project @ 2000-01-28 22:48:51 by jwe]
author jwe
date Fri, 28 Jan 2000 22:48:52 +0000
parents 2c7524ffdbf5
children 43350974ba1b
files liboctave/Array2.h liboctave/Array3.cc liboctave/Array3.h liboctave/ChangeLog
diffstat 4 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array2.h	Fri Jan 28 22:44:14 2000 +0000
+++ b/liboctave/Array2.h	Fri Jan 28 22:48:52 2000 +0000
@@ -43,12 +43,10 @@
 template <class T>
 class Array2 : public Array<T>
 {
-private:
+protected:
 
   int get_size (int r, int c) const;
 
-protected:
-
   Array2 (T *d, int n, int m) : Array<T> (d, get_size (n, m))
     {
       d1 = n;
--- a/liboctave/Array3.cc	Fri Jan 28 22:44:14 2000 +0000
+++ b/liboctave/Array3.cc	Fri Jan 28 22:48:52 2000 +0000
@@ -66,7 +66,9 @@
   int old_d3 = dim3 ();
   int old_len = length ();
 
-  rep = new ArrayRep (r*c*p);
+  int ts = get_size (get_size (r, c), p);
+
+  rep = new ArrayRep (ts);
 
   d1 = r;
   d2 = c;
@@ -111,7 +113,9 @@
 
   int old_len = length ();
 
-  rep = new ArrayRep (r*c*p);
+  int ts = get_size (get_size (r, c), p);
+
+  rep = new ArrayRep (ts);
 
   d1 = r;
   d2 = c;
--- a/liboctave/Array3.h	Fri Jan 28 22:44:14 2000 +0000
+++ b/liboctave/Array3.h	Fri Jan 28 22:48:52 2000 +0000
@@ -45,7 +45,7 @@
 
   int d3;
 
-  Array3 (T *d, int n, int m, int k) : Array2<T> (d, n, m*k)
+  Array3 (T *d, int n, int m, int k) : Array2<T> (d, n, get_size (m, k))
     {
       d2 = m;
       d3 = k;
@@ -61,7 +61,7 @@
       set_max_indices (3);
     }
 
-  Array3 (int n, int m, int k) : Array2<T> (n, m*k)
+  Array3 (int n, int m, int k) : Array2<T> (n, get_size (m, k))
     {
       d2 = m;
       d3 = k;
--- a/liboctave/ChangeLog	Fri Jan 28 22:44:14 2000 +0000
+++ b/liboctave/ChangeLog	Fri Jan 28 22:48:52 2000 +0000
@@ -1,5 +1,9 @@
 2000-01-28  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* Array2.h (Array2<T>::get_size): Now protected instead of private.
+	* Array3.h, Array3.cc: Use it in constructors and resize methods
+	to get total size to be allocated.
+
 	* DASSL.cc (DASSL::integrate): Declare do_restart and save_output
 	as bool, not int.