Mercurial > octave
comparison scripts/sparse/svds.m @ 20942:7832c351a6f5
svds.m: Don't save/restore randn seed in BIST tests.
* svds.m: Don't save/restore randn seed in BIST tests.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 18 Dec 2015 16:21:05 -0800 |
parents | 516bb87ea72e |
children | 77f5591878bf |
comparison
equal
deleted
inserted
replaced
20941:a4f5da7c5463 | 20942:7832c351a6f5 |
---|---|
257 %! s = diag (s); | 257 %! s = diag (s); |
258 %! [~, idx] = sort (abs (s)); | 258 %! [~, idx] = sort (abs (s)); |
259 %! s = s(idx); | 259 %! s = s(idx); |
260 %! u = u(:, idx); | 260 %! u = u(:, idx); |
261 %! v = v(:, idx); | 261 %! v = v(:, idx); |
262 %! randn_state = randn ("state"); | |
263 %! rand_state = rand ("state"); | 262 %! rand_state = rand ("state"); |
264 %! randn ("state", 42); % Initialize to make normest function reproducible | |
265 %! rand ("state", 42); | 263 %! rand ("state", 42); |
266 %! opts.v0 = rand (2*n,1); % Initialize eigs ARPACK starting vector | 264 %! opts.v0 = rand (2*n,1); % Initialize eigs ARPACK starting vector |
267 %! % to guarantee reproducible results | 265 %! % to guarantee reproducible results |
268 %! | 266 %! |
269 %!testif HAVE_ARPACK | 267 %!testif HAVE_ARPACK |
299 %!testif HAVE_ARPACK | 297 %!testif HAVE_ARPACK |
300 %! s = svds (speye (10)); | 298 %! s = svds (speye (10)); |
301 %! assert (s, ones (6, 1), 8*eps); | 299 %! assert (s, ones (6, 1), 8*eps); |
302 | 300 |
303 %!test | 301 %!test |
304 %! ## Restore random number generator seeds at end of tests | 302 %! ## Restore random number generator seed at end of tests |
305 %! rand ("state", rand_state); | 303 %! rand ("state", rand_state); |
306 %! randn ("state", randn_state); | 304 |
307 |