Mercurial > hg > octave-nkf
changeset 13213:544304a09e42
Fix offbyones and typos in sprandsym.m
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Sun, 25 Sep 2011 02:35:55 -0500 |
parents | e81b93284605 |
children | 7715aca4bce1 |
files | scripts/sparse/sprandsym.m |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/sparse/sprandsym.m +++ b/scripts/sparse/sprandsym.m @@ -66,7 +66,7 @@ offdiag = randperm (n*(n - 1)/2, m); ## Row index - i = lookup (cumsum (1:n), offdiag) + 2; + i = lookup (cumsum (0:n), offdiag - 1) + 1; ## Column index j = offdiag - (i - 1).*(i - 2)/2; @@ -125,7 +125,7 @@ d = [mod(k,2):2:min(n,k)-2]; m = (k - d)/2; q = (n - d).*(n - d - 1).*m ./ (d + 2)./(d + 1)./(a - m + 1); - c = [1 cumprod (q)]; + c = [1 cumprod(q)]; s = sum (c); p = c/s;