changeset 28411:c57b33d1db48

etree: accept logical sparse matrices * colamd.cc (Fetree): Also accept logical sparse matrices. Update tests.
author John W. Eaton <jwe@octave.org>
date Sat, 06 Jun 2020 11:17:42 -0400
parents 4bb892170ebb
children cd86f37bfbc3
files libinterp/corefcn/colamd.cc
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/colamd.cc	Fri Jun 05 16:57:44 2020 -0400
+++ b/libinterp/corefcn/colamd.cc	Sat Jun 06 11:17:42 2020 -0400
@@ -692,6 +692,15 @@
       ridx = scm.xridx ();
       cidx = scm.xcidx ();
     }
+  else if (args(0).islogical ())
+    {
+      SparseBoolMatrix sbm = args(0).sparse_bool_matrix_value ();
+
+      n_row = sbm.rows ();
+      n_col = sbm.cols ();
+      ridx = sbm.xridx ();
+      cidx = sbm.xcidx ();
+    }
   else
     {
       SparseMatrix sm = args(0).sparse_matrix_value ();
@@ -763,7 +772,9 @@
 }
 
 /*
-%!assert (etree (speye (2)), [0, 0]);
+%!assert (etree (sparse ([1,2], [1,2], [1,1], 2, 2)), [0, 0]);
+%!assert (etree (sparse ([1,2], [1,2], [true, true], 2, 2)), [0, 0]);
+%!assert (etree (sparse ([1,2], [1,2], [i,i], 2, 2)), [0, 0]);
 %!assert (etree (gallery ("poisson", 16)), [2:256, 0]);
 
 %!error etree ()