Functions | |
endif | if (nargin==1)[i |
if (nargout > 1) mean | |
endif | if (nargout > 2) diff |
!assert (n, sparse([4, 2])) | |
!assert (m, sparse([10/4, 3/2]), 10 *eps) | |
!assert (v, sparse([5/3, 1/2]), 10 *eps) | |
Variables | |
function [count, mean, var] | |
endif | j |
endif | v = find (S) |
i = 1:length (v) | |
S = sparse (i, j, v) | |
endif [n, m] = size (S) | |
count = sum (sparse (i, j, 1, n, m)) | |
var = sum (diff .* diff) ./ (count - 1) | |
endif endfunction | !test [n, m, v] = spstats([1 2 1 2 3 4],[2 2 1 1 1 1]) |
!assert | ( | v | , | |
sparse([5/3, 1/2]) | , | |||
10 * | eps | |||
) |
!assert | ( | m | , | |
sparse([10/4, 3/2]) | , | |||
10 * | eps | |||
) |
!assert | ( | n | , | |
sparse([4, 2]) | ||||
) |
endif if | ( | nargout | , | |
2 | ||||
) |
if | ( | nargout | , | |
1 | ||||
) |
endif endfunction !test[n, m, v] = spstats([1 2 1 2 3 4],[2 2 1 1 1 1]) |
endif[n, m] = size (S) |
i = 1:length (v) |
S = sparse (i, j, v) |
else v = find (S) |