diff liboctave/ArrayN.h @ 4504:f6a61399bc5c

[project @ 2003-09-09 17:48:00 by jwe]
author jwe
date Tue, 09 Sep 2003 17:49:13 +0000
parents 49d88738a4a0
children 508238e65af7
line wrap: on
line diff
--- a/liboctave/ArrayN.h
+++ b/liboctave/ArrayN.h
@@ -36,6 +36,7 @@
 #include <cstdlib>
 
 #include "Array.h"
+#include "dMatrix.h"
 #include "lo-error.h"
 
 class idx_vector;
@@ -92,6 +93,22 @@
       set_max_indices (dimensions.length ());
     }
 
+  // New constructor which takes a Matrix as an argument.  This should
+  // be moved to a subclass of ArrayN (NDArray) once we add a double
+  // instantiation of ArrayN.
+
+  ArrayN (const Matrix& m) : Array<T> (m)
+    {
+      set_max_indices (2);
+
+      Array<int> dim (2);
+
+      dim(0) = m.dim1 ();
+      dim(1) = m.dim2 ();
+
+      dimensions = dim;
+    }
+
   ~ArrayN (void) { }
 
   ArrayN<T>& operator = (const ArrayN<T>& a)
@@ -185,7 +202,8 @@
 
   ArrayN<T> index (Array<idx_vector>& ra_idx, int resize_ok = 0,
 		   const T& rfv = resize_fill_value (T ())) const;
-
+  
+  void maybe_delete_dims (void);
 #endif
 };