Mercurial > hg > octave-lyh
comparison scripts/sparse/sprandsym.m @ 16037:095d8d22c87d
Undo accidental unrelated changein dd583c258cf9
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 11 Feb 2013 11:31:45 -0500 |
parents | dd583c258cf9 |
children | 088d014a7fe2 |
comparison
equal
deleted
inserted
replaced
16036:dd583c258cf9 | 16037:095d8d22c87d |
---|---|
125 endif | 125 endif |
126 | 126 |
127 ## Compute the stuff described above | 127 ## Compute the stuff described above |
128 a = n*(n - 1)/2; | 128 a = n*(n - 1)/2; |
129 d = [mod(k,2):2:min(n,k)-2]; | 129 d = [mod(k,2):2:min(n,k)-2]; |
130 | |
131 ## Since we | |
132 if (isempty (d)) | |
133 keyboard | |
134 endif | |
135 | |
136 m = (k - d)/2; | 130 m = (k - d)/2; |
137 q = (n - d).*(n - d - 1).*m ./ (d + 2)./(d + 1)./(a - m + 1); | 131 q = (n - d).*(n - d - 1).*m ./ (d + 2)./(d + 1)./(a - m + 1); |
138 | 132 |
139 ## Slight modification from discussion above: pivot around the max in | 133 ## Slight modification from discussion above: pivot around the max in |
140 ## order to avoid overflow (underflow is fine, just means effectively | 134 ## order to avoid overflow (underflow is fine, just means effectively |