changeset 90:13e31c27ba23 octave-forge

ill-conditioned rectangular matrix for testing QR
author pkienzle
date Fri, 21 Dec 2001 20:45:06 +0000
parents e8f61d62fa8a
children e3f563729dce
files main/special-matrix/lauchli.m
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/special-matrix/lauchli.m	Fri Dec 21 20:45:06 2001 +0000
@@ -0,0 +1,23 @@
+## A = lauchli (n [,mu])
+##    Creates the matrix [ ones(1,n); mu*eye(n) ]
+##    The value mu defaults to sqrt(eps)
+##    This is an ill-conditioned system for testing the
+##    accuracy of the QR routine.
+##    E.g., 
+##       A = lauchli(15);
+##       [Q, R] = qr(A);
+##       norm(Q*R - A)
+##       norm(Q'*Q - eye(rows(Q)))
+
+## This program is in the public domain
+
+function A = lauchli(n,mu)
+  if (nargin < 1 || nargin > 2)
+    usage("A = lauchli(n [, mu])");
+  endif
+
+  if (nargin < 2), mu = sqrt(eps); endif
+
+  A = [ ones(1,n); mu*eye(n) ];
+
+endfunction