Mercurial > octave-nkf
comparison scripts/sparse/svds.m @ 14182:f8d99761244c stable
test: Expand %!testif functionality to multiple conditions
* test.m: Add testing for multiple conditions in %!testif statement.
* svds.m, eigs.cc: Test for ARPACK and other libraries before running
some tests.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 09 Jan 2012 13:32:44 -0800 |
parents | 834df9f10963 |
children | 4d917a6a858b |
comparison
equal
deleted
inserted
replaced
14181:6b28e8a8c777 | 14182:f8d99761244c |
---|---|
262 %! [u2,s2,v2,flag] = svds (A,k); | 262 %! [u2,s2,v2,flag] = svds (A,k); |
263 %! s2 = diag (s2); | 263 %! s2 = diag (s2); |
264 %! assert (flag, !1); | 264 %! assert (flag, !1); |
265 %! assert (s2, s(end:-1:end-k+1), 1e-10); | 265 %! assert (s2, s(end:-1:end-k+1), 1e-10); |
266 %! | 266 %! |
267 %!testif HAVE_UMFPACK | 267 %!testif HAVE_ARPACK, HAVE_UMFPACK |
268 %! [u2,s2,v2,flag] = svds (A,k,0,opts); | 268 %! [u2,s2,v2,flag] = svds (A,k,0,opts); |
269 %! s2 = diag (s2); | 269 %! s2 = diag (s2); |
270 %! assert (flag, !1); | 270 %! assert (flag, !1); |
271 %! assert (s2, s(k:-1:1), 1e-10); | 271 %! assert (s2, s(k:-1:1), 1e-10); |
272 %! | 272 %! |
273 %!testif HAVE_UMFPACK | 273 %!testif HAVE_ARPACK, HAVE_UMFPACK |
274 %! idx = floor(n/2); | 274 %! idx = floor(n/2); |
275 %! % Don't put sigma right on a singular value or there are convergence issues | 275 %! % Don't put sigma right on a singular value or there are convergence issues |
276 %! sigma = 0.99*s(idx) + 0.01*s(idx+1); | 276 %! sigma = 0.99*s(idx) + 0.01*s(idx+1); |
277 %! [u2,s2,v2,flag] = svds (A,k,sigma,opts); | 277 %! [u2,s2,v2,flag] = svds (A,k,sigma,opts); |
278 %! s2 = diag (s2); | 278 %! s2 = diag (s2); |