changeset 9425:e9f1329ed504

nonzeros: always return a column vector
author John W. Eaton <jwe@octave.org>
date Thu, 09 Jul 2009 15:12:27 -0400
parents 69d05d1a63b9
children 40da70ba1fc6
files scripts/ChangeLog scripts/sparse/nonzeros.m
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Jul 09 15:04:34 2009 -0400
+++ b/scripts/ChangeLog	Thu Jul 09 15:12:27 2009 -0400
@@ -1,3 +1,7 @@
+2009-07-09  John W. Eaton  <jwe@octave.org>
+
+	* sparse/nonzeros.m: Always return a column vector.  New tests.
+
 2009-06-25  Ben Abbott <bpabbott@mac.com>
 
 	* plot/gnuplot_drawnow.m: Apply feature 'wxt_has_size'.
--- a/scripts/sparse/nonzeros.m	Thu Jul 09 15:04:34 2009 -0400
+++ b/scripts/sparse/nonzeros.m	Thu Jul 09 15:12:27 2009 -0400
@@ -28,7 +28,12 @@
   endif
 
   [i, j, t] = find (s);
+
+  t = t(:);
+
 endfunction
 
 %!assert(nonzeros([1,2;3,0]),[1;3;2])
+%!assert(nonzeros([1,2,3,0]),[1;3;2])
 %!assert(nonzeros(sparse([1,2;3,0])),[1;3;2])
+%!assert(nonzeros(sparse([1,2,3,0])),[1;3;2])