Mercurial > hg > octave-nkf
changeset 4069:593e213748b9
[project @ 2002-09-27 00:53:47 by jwe]
author | jwe |
---|---|
date | Fri, 27 Sep 2002 00:53:47 +0000 |
parents | 2c088a2f36e2 |
children | e0e95e9aad7b |
files | test/ChangeLog test/octave.test/linalg/qr-7.m |
diffstat | 2 files changed, 40 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,10 @@ +2002-09-26 Paul Kienzle <pkienzle@users.sf.net> + + * octave.test/linalg/qr-7.m: Replace large random matrix tests + of economy QR decomposition with small predictable tests. + Include numerically sensitive rosser matrix test. Don't + report the measured norms. + 2002-04-24 Bill Lash <lash@tellabs.com> * test/octave.test/signal/signal.exp: Add unwrap test.
--- a/test/octave.test/linalg/qr-7.m +++ b/test/octave.test/linalg/qr-7.m @@ -1,25 +1,27 @@ function retval = testqr (q, r, a, p) - tol = 512*eps; + tol = 10*eps; retval = 0; if (nargin == 3) n1 = norm (q*r-a); n2 = norm (q'*q-eye(columns(q))); retval = (n1 < tol && n2 < tol); else - n1 = norm (q'*q-eye(columns(q))) + n1 = norm (q'*q-eye(columns(q))); retval = (n1 < tol); if (isvector (p)) - n2 = norm (q*r-a(:,p)) + n2 = norm (q*r-a(:,p)); retval = (retval && n2 < tol); else - n2 = norm (q*r - a*p) + n2 = norm (q*r - a*p); retval = (retval && n2 < tol); endif endif endfunction -t = zeros (16, 1); +t = ones (24, 1); j = 1; + +if 0 # eliminate big matrix tests a = rand(5000,20); [q,r]=qr(a,0); t(j++) = testqr(q,r,a); [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); @@ -31,6 +33,7 @@ [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); +endif a = [ ones(1,15); sqrt(eps)*eye(15) ]; [q,r]=qr(a); t(j++) = testqr(q,r,a); @@ -44,4 +47,28 @@ [q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); [q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); -all (t) +a = [ ones(1,15); sqrt(eps)*eye(15) ]; +[q,r]=qr(a,0); t(j++) = testqr(q,r,a); +[q,r]=qr(a',0); t(j++) = testqr(q,r,a'); +[q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); +[q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); + +a = a+1i*randn(size(a))*sqrt(eps); +[q,r]=qr(a,0); t(j++) = testqr(q,r,a); +[q,r]=qr(a',0); t(j++) = testqr(q,r,a'); +[q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); +[q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); + +a = [ + 611 196 -192 407 -8 -52 -49 29 + 196 899 113 -192 -71 -43 -8 -44 + -192 113 899 196 61 49 8 52 + 407 -192 196 611 8 44 59 -23 + -8 -71 61 8 411 -599 208 208 + -52 -43 49 44 -599 411 208 208 + -49 -8 8 59 208 208 99 -911 + 29 -44 52 -23 208 208 -911 99 +]; +[q,r] = qr(a); + +all (t) && norm(q*r-a) < 2000*eps