diff src/DLD-FUNCTIONS/sparse.cc @ 8910:6e9f26506804

optimize diag -> sparse and perm -> sparse conversions
author Jaroslav Hajek <highegg@gmail.com>
date Thu, 05 Mar 2009 08:34:52 +0100
parents d254a21e0120
children eb63fbe60fab
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/sparse.cc	Thu Mar 05 00:55:56 2009 -0500
+++ b/src/DLD-FUNCTIONS/sparse.cc	Thu Mar 05 08:34:52 2009 +0100
@@ -146,6 +146,24 @@
 	       retval = new octave_sparse_matrix (sm);
 	     }
 	 }
+       else if (arg.is_diag_matrix ())
+         {
+           if (arg.is_complex_type ())
+             {
+	       SparseComplexMatrix sm = arg.sparse_complex_matrix_value ();
+	       retval = new octave_sparse_complex_matrix (sm);
+             }
+           else
+             {
+	       SparseMatrix sm = arg.sparse_matrix_value ();
+	       retval = new octave_sparse_matrix (sm);
+             }
+         }
+       else if (arg.is_perm_matrix ())
+         {
+           SparseMatrix sm = arg.sparse_matrix_value ();
+           retval = new octave_sparse_matrix (sm);
+         }
        else
 	 {
 	   if (use_complex)