Mercurial > octave-libgccjit
diff scripts/sparse/sprandsym.m @ 6498:2c85044aa63f
[project @ 2007-04-05 17:59:47 by jwe]
author | jwe |
---|---|
date | Thu, 05 Apr 2007 17:59:47 +0000 |
parents | 738c97e101eb |
children | 93c65f2a5668 |
line wrap: on
line diff
--- a/scripts/sparse/sprandsym.m Thu Apr 05 17:30:31 2007 +0000 +++ b/scripts/sparse/sprandsym.m Thu Apr 05 17:59:47 2007 +0000 @@ -42,7 +42,7 @@ n1 = m1 + rem (n, 2); mn1 = m1*n1; k1 = round (d*mn1); - idx1 = unique (fix(rand(min(k1*1.01,k1+10),1)*mn1))+1; + idx1 = unique (fix (rand (min (k1*1.01, k1+10), 1) * mn1)) + 1; ## idx contains random numbers in [1,mn] generate 1% or 10 more ## random values than necessary in order to reduce the probability ## that there are less than k distinct values; maybe a better @@ -54,7 +54,7 @@ n2 = ceil (n/2); nn2 = n2*n2; k2 = round (d*nn2); - idx2 = unique (fix (rand (min (k2*1.01, k1+10), 1)*nn2)) + 1; + idx2 = unique (fix (rand (min (k2*1.01, k1+10), 1) * nn2)) + 1; k2 = min (length (idx2), k2); j2 = floor ((idx2(1:k2)-1)/n2); i2 = idx2(1:k2) - j2*n2; @@ -63,7 +63,7 @@ S = sparse (n, n); else S1 = sparse (i1, j1+1, randn (k1, 1), m1, n1); - S = [tril(S1), sparse(m1,m1); ... + S = [tril(S1), sparse (m1, m1); ... sparse(i2,j2+1,randn(k2,1),n2,n2), triu(S1,1)']; S = S + tril (S, -1)'; endif