Mercurial > hg > octave-terminal
changeset 12365:044ca61e6750 release-3-4-x
Use testif to only run some sparse tests when necessary libraries are installed.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Wed, 02 Feb 2011 21:31:33 -0800 |
parents | 1a24d55b1714 |
children | 3dd1b0b36f13 |
files | scripts/ChangeLog scripts/sparse/svds.m src/ChangeLog src/DLD-FUNCTIONS/eigs.cc src/DLD-FUNCTIONS/qr.cc test/ChangeLog test/build_sparse_tests.sh |
diffstat | 7 files changed, 54 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-02-02 Rik <octave@nomad.inbox5.com> + + * sparse/svds.m: Use testif to only run some sparse tests when + necessary libraries are installed. + 2011-02-01 Ben Abbott <bpabbott@mac.com> * plot/__gnuplot_has_feature__.m: Don't throw an error if gnuplot
--- a/scripts/sparse/svds.m +++ b/scripts/sparse/svds.m @@ -258,12 +258,12 @@ %! s2 = diag(s2); %! assert(flag,!1); %! assert(s2, s(end:-1:end-k+1), 1e-10); -%!test +%!testif HAVE_UMFPACK %! [u2,s2,v2,flag] = svds(A,k,0,opts); %! s2 = diag(s2); %! assert(flag,!1); %! assert(s2, s(k:-1:1), 1e-10); -%!test +%!testif HAVE_UMFPACK %! idx = floor(n/2); %! % Don't put sigma right on a singular value or there are convergence issues %! sigma = 0.99*s(idx) + 0.01*s(idx+1);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-02-02 Rik <octave@nomad.inbox5.com> + + * DLD-FUNCTIONS/eigs.cc, DLD-FUNCTIONS/qr.cc: Use testif to only run + some sparse tests when necessary libraries are installed. + 2011-02-03 Konstantinos Poulios <logari81@googlemail.com> * graphics.cc (axes::properties::update_axes_layout):
--- a/src/DLD-FUNCTIONS/eigs.cc +++ b/src/DLD-FUNCTIONS/eigs.cc @@ -777,7 +777,7 @@ %!test %! d1 = eigs (A, k, 'lm'); %! assert (d1, d0(end:-1:(end-k+1)), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 'sm'); %! assert (d1, d0(k:-1:1), 1e-11); %!test @@ -792,15 +792,15 @@ %!test %! d1 = eigs (A, k+1, 'be'); %! assert (d1, d2([1:floor((k+1)/2), (end - ceil((k+1)/2) + 1):end]), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 4.1); %! [~,idx0] = sort (abs(d0 - 4.1)); %! [~,idx1] = sort (abs(d1 - 4.1)); %! assert (d1(idx1), d0(idx0(1:k)), 1e-11); -%!test +%!testif HAVE_CHOLMOD %! d1 = eigs(A, speye(n), k, 'lm'); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (eigs(A,k,4.1), eigs(A,speye(n),k,4.1), 1e-11); %!test %! opts.cholB=true; @@ -812,17 +812,17 @@ %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 'lm', opts); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! d1 = eigs(A, speye(n), k, 4.1, opts); %! assert (abs(d1), eigs(A,k,4.1), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! q = [2:n,1]; %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 4.1, opts); %! assert (abs(d1), eigs(A,k,4.1), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (eigs(A,k,4.1), eigs(A,speye(n),k,4.1), 1e-11); %!test %! fn = @(x) A * x; @@ -834,7 +834,7 @@ %! opts.issym = 1; opts.isreal = 1; %! d1 = eigs (fn, n, k, 'sm', opts); %! assert (d1, d0(k:-1:1), 1e-11); -%!test +%!testif HAVE_UMFPACK %! fn = @(x) (A - 4.1 * eye(n)) \ x; %! opts.issym = 1; opts.isreal = 1; %! d1 = eigs (fn, n, k, 4.1, opts); @@ -850,7 +850,7 @@ %! for i=1:k %! assert(max(abs((A - d1(i)*speye(n))*v1(:,i))),0.,1e-11) %! endfor -%!test +%!testif HAVE_UMFPACK %! [v1,d1] = eigs(A, k, 'sm'); %! d1 = diag(d1); %! for i=1:k @@ -897,7 +897,7 @@ %!test %! d1 = eigs (A, k, 'lm'); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 'sm'); %! assert (abs(d1), abs(d0(1:k)), 1e-11); %!test @@ -920,13 +920,13 @@ %! [~, idx] = sort (imag(abs(d0))); %! d2 = d0(idx); %! assert (sort(imag(d1)), sort(imag(d2(1:k))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 4.1); %! [~,idx0] = sort (abs(d0 - 4.1)); %! [~,idx1] = sort (abs(d1 - 4.1)); %! assert (abs(d1(idx1)), abs(d0(idx0(1:k))), 1e-11); %! assert (sort(imag(d1(idx1))), sort(imag(d0(idx0(1:k)))), 1e-11); -%!test +%!testif HAVE_CHOLMOD %! d1 = eigs(A, speye(n), k, 'lm'); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); %!test @@ -939,19 +939,19 @@ %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 'lm', opts); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! d1 = eigs(A, speye(n), k, 4.1, opts); %! assert (abs(d1), eigs(A,k,4.1), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! q = [2:n,1]; %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 4.1, opts); %! assert (abs(d1), eigs(A,k,4.1), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (abs(eigs(A,k,4.1)), abs(eigs(A,speye(n),k,4.1)), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (sort(imag(eigs(A,k,4.1))), sort(imag(eigs(A,speye(n),k,4.1))), 1e-11); %!test %! fn = @(x) A * x; @@ -963,7 +963,7 @@ %! opts.issym = 0; opts.isreal = 1; %! d1 = eigs (fn, n, k, 'sm', opts); %! assert (abs(d1), d0(1:k), 1e-11); -%!test +%!testif HAVE_UMFPACK %! fn = @(x) (A - 4.1 * eye(n)) \ x; %! opts.issym = 0; opts.isreal = 1; %! d1 = eigs (fn, n, k, 4.1, opts); @@ -974,7 +974,7 @@ %! for i=1:k %! assert(max(abs((A - d1(i)*speye(n))*v1(:,i))),0.,1e-11) %! endfor -%!test +%!testif HAVE_UMFPACK %! [v1,d1] = eigs(A, k, 'sm'); %! d1 = diag(d1); %! for i=1:k @@ -1027,7 +1027,7 @@ %!test %! d1 = eigs (A, k, 'lm'); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 'sm'); %! assert (abs(d1), abs(d0(1:k)), 1e-11); %!test @@ -1050,13 +1050,13 @@ %! [~, idx] = sort (imag(abs(d0))); %! d2 = d0(idx); %! assert (sort(imag(d1)), sort(imag(d2(1:k))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! d1 = eigs (A, k, 4.1); %! [~,idx0] = sort (abs(d0 - 4.1)); %! [~,idx1] = sort (abs(d1 - 4.1)); %! assert (abs(d1(idx1)), abs(d0(idx0(1:k))), 1e-11); %! assert (sort(imag(d1(idx1))), sort(imag(d0(idx0(1:k)))), 1e-11); -%!test +%!testif HAVE_CHOLMOD %! d1 = eigs(A, speye(n), k, 'lm'); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); %!test @@ -1069,21 +1069,21 @@ %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 'lm', opts); %! assert (abs(d1), abs(d0(end:-1:(end-k+1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! d1 = eigs(A, speye(n), k, 4.1, opts); %! assert (abs(abs(d1)), abs(eigs(A,k,4.1)), 1e-11); %! assert (sort(imag(abs(d1))), sort(imag(eigs(A,k,4.1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! opts.cholB=true; %! q = [2:n,1]; %! opts.permB=q; %! d1 = eigs(A, speye(n)(q,q), k, 4.1, opts); %! assert (abs(abs(d1)), abs(eigs(A,k,4.1)), 1e-11); %! assert (sort(imag(abs(d1))), sort(imag(eigs(A,k,4.1))), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (abs(eigs(A,k,4.1)), abs(eigs(A,speye(n),k,4.1)), 1e-11); -%!test +%!testif HAVE_UMFPACK %! assert (sort(imag(eigs(A,k,4.1))), sort(imag(eigs(A,speye(n),k,4.1))), 1e-11); %!test %! fn = @(x) A * x; @@ -1095,7 +1095,7 @@ %! opts.issym = 0; opts.isreal = 0; %! d1 = eigs (fn, n, k, 'sm', opts); %! assert (abs(d1), d0(1:k), 1e-11); -%!test +%!testif HAVE_UMFPACK %! fn = @(x) (A - 4.1 * eye(n)) \ x; %! opts.issym = 0; opts.isreal = 0; %! d1 = eigs (fn, n, k, 4.1, opts); @@ -1106,7 +1106,7 @@ %! for i=1:k %! assert(max(abs((A - d1(i)*speye(n))*v1(:,i))),0.,1e-11) %! endfor -%!test +%!testif HAVE_UMFPACK %! [v1,d1] = eigs(A, k, 'sm'); %! d1 = diag(d1); %! for i=1:k
--- a/src/DLD-FUNCTIONS/qr.cc +++ b/src/DLD-FUNCTIONS/qr.cc @@ -682,7 +682,7 @@ %! r = qr(a); %! assert(r'*r,a'*a,1e-10) -%!testif HAVE_CXSPARSE +%!testif HAVE_COLAMD %! n = 20; d= 0.2; %! a = sprandn(n,n,d)+speye(n,n); %! q = symamd(a); @@ -717,7 +717,7 @@ %! r = qr(a); %! assert(r'*r,a'*a,1e-10) -%!testif HAVE_CXSPARSE +%!testif HAVE_COLAMD %! n = 20; d= 0.2; %! a = 1i*sprandn(n,n,d)+speye(n,n); %! q = symamd(a);
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2010-02-02 Rik <octave@nomad.inbox5.com> + + * build_sparse_tests.sh: Use testif to only run some sparse tests when + necessary libraries are installed. + 2011-01-14 John W. Eaton <jwe@octave.org> * Update copyright notices for 2011.
--- a/test/build_sparse_tests.sh +++ b/test/build_sparse_tests.sh @@ -1018,7 +1018,7 @@ %! assert (sparse(a * x), b, feps); %! b = sprandn(sz(1),sz(2),0.2)+1i*sprandn(sz(1),sz(2),0.2); x = a \b; %! assert (sparse(a * x), b, feps); -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! a = alpha*sprandn(10,11,0.2)+speye(10,11); f(a,[10,2],1e-10); %! ## Test this by forcing matrix_type, as can't get a certain %! ## result for over-determined systems. @@ -1068,17 +1068,17 @@ %!testif HAVE_CXSPARSE %! [c,r] = qr (us, xf); %! assert(us\xf,r\c,100*eps) -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (us, xs); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(us\xs,r\c,100*eps) %!test %! pus = us(:,[1:8,10,9]); -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (pus, xf); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(pus\xf,r\c,100*eps) -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (pus, xs); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(pus\xs,r\c,100*eps) @@ -1096,20 +1096,20 @@ %! ls = alpha*[speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]; %! xf = beta * ones(12,2); %! xs = speye(12,12); -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (ls, xf); %! assert(ls\xf,r\c,100*eps) -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (ls, xs); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(ls\xs,r\c,100*eps) %!testif HAVE_CXSPARSE %! pls = ls(:,[1:8,10,9]); -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (pls, xf); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(pls\xf,r\c,100*eps) -%!testif HAVE_CXSPARSE +%!testif HAVE_UMFPACK %! [c,r] = qr (pls, xs); %! r = matrix_type(r,"Singular"); ## Force Matrix Type %! assert(pls\xs,r\c,100*eps)