comparison scripts/sparse/colperm.m @ 7125:f084ba47812b

[project @ 2007-11-08 02:29:23 by jwe]
author jwe
date Thu, 08 Nov 2007 02:29:24 +0000
parents a1dbe9d80eee
children f5005d9510f4
comparison
equal deleted inserted replaced
7124:d07cb867891b 7125:f084ba47812b
24 ## such that @code{@var{s} (@var{p}, @var{p})} orders the rows and 24 ## such that @code{@var{s} (@var{p}, @var{p})} orders the rows and
25 ## columns with increasing number of non zeros elements. 25 ## columns with increasing number of non zeros elements.
26 ## @end deftypefn 26 ## @end deftypefn
27 27
28 function p = colperm (s) 28 function p = colperm (s)
29
30 if (nargin != 1)
31 print_usage ();
32 endif
33
29 [i, j] = spfind (s); 34 [i, j] = spfind (s);
30 idx = find (diff ([j; Inf]) != 0); 35 idx = find (diff ([j; Inf]) != 0);
31 [dummy, p] = sort (idx - [0; idx(1:(end-1))]); 36 [dummy, p] = sort (idx - [0; idx(1:(end-1))]);
32 endfunction 37 endfunction