Mercurial > hg > octave-nkf
comparison scripts/sparse/eigs.m @ 20038:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children | df437a52bcaf |
comparison
equal
deleted
inserted
replaced
20037:a1acca0c2216 | 20038:9fc020886ae9 |
---|---|
488 | 488 |
489 ## Real unsymmetric tests | 489 ## Real unsymmetric tests |
490 %!shared n, k, A, d0 | 490 %!shared n, k, A, d0 |
491 %! n = 20; | 491 %! n = 20; |
492 %! k = 4; | 492 %! k = 4; |
493 %! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]); | 493 %! A = sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)]); |
494 %! d0 = eig (A); | 494 %! d0 = eig (A); |
495 %! [~, idx] = sort (abs (d0)); | 495 %! [~, idx] = sort (abs (d0)); |
496 %! d0 = d0(idx); | 496 %! d0 = d0(idx); |
497 %! rand ("state", 42); % initialize generator to make eigs behavior reproducible | 497 %! rand ("state", 42); % initialize generator to make eigs behavior reproducible |
498 %!testif HAVE_ARPACK | 498 %!testif HAVE_ARPACK |
857 | 857 |
858 ## Real unsymmetric tests | 858 ## Real unsymmetric tests |
859 %!shared n, k, A, d0 | 859 %!shared n, k, A, d0 |
860 %! n = 20; | 860 %! n = 20; |
861 %! k = 4; | 861 %! k = 4; |
862 %! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)])); | 862 %! A = full (sparse ([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),1:n,-ones(1,n-2)])); |
863 %! d0 = eig (A); | 863 %! d0 = eig (A); |
864 %! [~, idx] = sort (abs (d0)); | 864 %! [~, idx] = sort (abs (d0)); |
865 %! d0 = d0(idx); | 865 %! d0 = d0(idx); |
866 %! rand ("state", 42); % initialize generator to make eigs behavior reproducible | 866 %! rand ("state", 42); % initialize generator to make eigs behavior reproducible |
867 %!testif HAVE_ARPACK | 867 %!testif HAVE_ARPACK |