diff src/ov-re-mat.cc @ 8399:c1bada868690

alow single/double conversion of diag & perm matrices
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 11 Dec 2008 11:04:18 +0100
parents 25bc2d31e1bf
children f00578b495e9
line wrap: on
line diff
--- a/src/ov-re-mat.cc	Thu Dec 11 11:04:00 2008 +0100
+++ b/src/ov-re-mat.cc	Thu Dec 11 11:04:18 2008 +0100
@@ -55,6 +55,9 @@
 #include "ov-complex.h"
 #include "ov-cx-mat.h"
 #include "ov-re-sparse.h"
+#include "ov-re-diag.h"
+#include "ov-cx-diag.h"
+#include "ov-perm.h"
 #include "ov-type-conv.h"
 #include "pr-output.h"
 #include "variables.h"
@@ -829,9 +832,24 @@
   // inside their own scopes, and we don't declare retval here to
   // avoid a shadowed declaration warning.
 
-  if (args.length () == 1)
+  if (args(0).is_perm_matrix ())
+    {
+      OCTAVE_TYPE_CONV_BODY3 (double, octave_perm_matrix, octave_scalar);
+    }
+  else if (args.length () == 1)
     {
-      if (args(0).is_sparse_type ())
+      if (args(0).is_diag_matrix ())
+        {
+	  if (args(0).is_complex_type ())
+	    {
+	      OCTAVE_TYPE_CONV_BODY3 (double, octave_complex_diag_matrix, octave_complex);
+	    }
+	  else
+	    {
+	      OCTAVE_TYPE_CONV_BODY3 (double, octave_diag_matrix, octave_scalar);
+	    }
+        }
+      else if (args(0).is_sparse_type ())
 	{
 	  if (args(0).is_complex_type ())
 	    {