comparison scripts/sparse/spones.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 aeeb646f6538
comparison
equal deleted inserted replaced
7124:d07cb867891b 7125:f084ba47812b
21 ## Replace the non-zero entries of @var{x} with ones. This creates a 21 ## Replace the non-zero entries of @var{x} with ones. This creates a
22 ## sparse matrix with the same structure as @var{x}. 22 ## sparse matrix with the same structure as @var{x}.
23 ## @end deftypefn 23 ## @end deftypefn
24 24
25 function s = spones (s) 25 function s = spones (s)
26
27 if (nargin != 1)
28 print_usage ();
29 endif
30
26 if (issparse (s)) 31 if (issparse (s))
27 [i, j, v, m, n] = spfind (s); 32 [i, j, v, m, n] = spfind (s);
28 else 33 else
29 [i, j, v] = find (s); 34 [i, j, v] = find (s);
30 [m, n] = size (s); 35 [m, n] = size (s);