Mercurial > hg > octave-avbm
changeset 3884:fcb4931ec48a
[project @ 2002-04-02 22:23:45 by jwe]
author | jwe |
---|---|
date | Tue, 02 Apr 2002 22:23:46 +0000 |
parents | 69b6bd271277 |
children | f49111e2d8a4 |
files | src/ChangeLog test/ChangeLog test/octave.test/linalg/qr-7.m |
diffstat | 3 files changed, 53 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,8 +7,7 @@ break out of parse-execute loop. (parse_fcn_file): Likewise. (eval_string): Likewise. - * toplev.cc (main_loop): Likewise. - + * toplev.cc (main_loop): Likewise. * parse.y (input): Call YYACCEPT for END_OF_INPUT. Return no-op command for bare newline.
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2002-04-02 John W. Eaton <jwe@bevo.che.wisc.edu> + + * octave.test/linalg/qr-7.m: New test. + From Paul Kienzle <pkienzle@jazz.ncnr.nist.gov>. + 2001-04-24 Christoph Spiel <cspiel@hammersmith-consulting.com> * Makefile.in (check): Allow user to specify which .exp file to run.
new file mode 100644 --- /dev/null +++ b/test/octave.test/linalg/qr-7.m @@ -0,0 +1,47 @@ +function retval = testqr (q, r, a, p) + tol = 512*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))) + retval = (n1 < tol); + if (is_vector (p)) + n2 = norm (q*r-a(:,p)) + retval = (retval && n2 < tol); + else + n2 = norm (q*r - a*p) + retval = (retval && n2 < tol); + endif + endif +endfunction + +t = zeros (16, 1); +j = 1; +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'); +[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 = [ ones(1,15); sqrt(eps)*eye(15) ]; +[q,r]=qr(a); t(j++) = testqr(q,r,a); +[q,r]=qr(a'); t(j++) = testqr(q,r,a'); +[q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); +[q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); + +a = a+1i*randn(size(a))*sqrt(eps); +[q,r]=qr(a); t(j++) = testqr(q,r,a); +[q,r]=qr(a'); t(j++) = testqr(q,r,a'); +[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)