changeset 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 d95282fa0579
children 7b6e1fc1cb90
files src/ChangeLog src/ov-flt-re-mat.cc src/ov-re-mat.cc
diffstat 3 files changed, 44 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Dec 11 11:04:00 2008 +0100
+++ b/src/ChangeLog	Thu Dec 11 11:04:18 2008 +0100
@@ -1,3 +1,8 @@
+2008-12-11  Jaroslav Hajek  <highegg@gmail.com>
+	
+	* ov-re-mat.cc (Fdouble): Handle diagonal & perm matrices. 
+	* ov-flt-re-mat.cc (Fsingle): Handle diagonal & perm matrices. 
+
 2008-12-11  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-base-diag.cc (octave_base_diag<DMT,MT>::subsasgn): New method.
--- a/src/ov-flt-re-mat.cc	Thu Dec 11 11:04:00 2008 +0100
+++ b/src/ov-flt-re-mat.cc	Thu Dec 11 11:04:18 2008 +0100
@@ -56,6 +56,9 @@
 #include "ov-flt-re-mat.h"
 #include "ov-flt-cx-mat.h"
 #include "ov-re-sparse.h"
+#include "ov-flt-re-diag.h"
+#include "ov-flt-cx-diag.h"
+#include "ov-flt-perm.h"
 #include "ov-type-conv.h"
 #include "pr-output.h"
 #include "variables.h"
@@ -804,7 +807,22 @@
 
   if (args.length () == 1)
     {
-      if (args(0).is_sparse_type ())
+      if (args(0).is_perm_matrix ())
+        {
+          OCTAVE_TYPE_CONV_BODY3 (single, octave_float_perm_matrix, octave_float_scalar);
+        }
+      else if (args(0).is_diag_matrix ())
+        {
+	  if (args(0).is_complex_type ())
+	    {
+	      OCTAVE_TYPE_CONV_BODY3 (single, octave_float_complex_diag_matrix, octave_float_complex);
+	    }
+	  else
+	    {
+	      OCTAVE_TYPE_CONV_BODY3 (single, octave_float_diag_matrix, octave_float_scalar);
+	    }
+        }
+      else if (args(0).is_sparse_type ())
 	{
 	  error ("single: sparse type do not support single precision");
 	}
--- 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 ())
 	    {