comparison scripts/sparse/eigs.m @ 29103:9f31fe6f79f0

maint: merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 26 Nov 2020 19:19:26 +0100
parents 960099d8a691 40d95224c155
children 1cdd4619d0b9
comparison
equal deleted inserted replaced
29101:b1d1e47092a6 29103:9f31fe6f79f0
546 %!testif HAVE_ARPACK, HAVE_UMFPACK 546 %!testif HAVE_ARPACK, HAVE_UMFPACK
547 %! fn = @(x) (A - 4.1 * eye (n)) \ x; 547 %! fn = @(x) (A - 4.1 * eye (n)) \ x;
548 %! opts.issym = 1; opts.isreal = 1; 548 %! opts.issym = 1; opts.isreal = 1;
549 %! d1 = eigs (fn, n, k, 4.1, opts); 549 %! d1 = eigs (fn, n, k, 4.1, opts);
550 %! assert (d1, eigs (A, k, 4.1), 1e-11); 550 %! assert (d1, eigs (A, k, 4.1), 1e-11);
551 %!testif HAVE_ARPACK 551 %!testif HAVE_ARPACK, HAVE_UMFPACK
552 %! AA = speye (10); 552 %! AA = speye (10);
553 %! fn = @(x) AA * x; 553 %! fn = @(x) AA * x;
554 %! opts.issym = 1; opts.isreal = 1; 554 %! opts.issym = 1; opts.isreal = 1;
555 %! assert (eigs (fn, 10, AA, 3, "lm", opts), [1; 1; 1], 10*eps); 555 %! assert (eigs (fn, 10, AA, 3, "lm", opts), [1; 1; 1], 10*eps);
556 %!testif HAVE_ARPACK 556 %!testif HAVE_ARPACK
1533 %! opts.maxit = 1; 1533 %! opts.maxit = 1;
1534 %! opts.isreal = false; 1534 %! opts.isreal = false;
1535 %! warning ("off", "Octave:eigs:UnconvergedEigenvalues", "local"); 1535 %! warning ("off", "Octave:eigs:UnconvergedEigenvalues", "local");
1536 %! d = eigs (Afun, 100, 6, "lm", opts); 1536 %! d = eigs (Afun, 100, 6, "lm", opts);
1537 %! assert (d(6), NaN+1i*NaN); 1537 %! assert (d(6), NaN+1i*NaN);
1538 %!testif HAVE_ARPACK 1538 %!testif HAVE_ARPACK, HAVE_CHOLMOD
1539 %! A = sparse (magic (10)); 1539 %! A = sparse (magic (10));
1540 %! B = sparse (magic (10)); # not HPD 1540 %! B = sparse (magic (10)); # not HPD
1541 %! fail ("eigs (A, B, 4)", "eigs: The matrix B is not positive definite") 1541 %! fail ("eigs (A, B, 4)", "eigs: The matrix B is not positive definite")
1542 %!testif HAVE_ARPACK 1542 %!testif HAVE_ARPACK
1543 %! i_A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; 1543 %! i_A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];