X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fmiscellaneous-1.1.0%2Flauchli.m;fp=octave_packages%2Fmiscellaneous-1.1.0%2Flauchli.m;h=3f65737324ff150b52122679edc4c8c376d3a791;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/miscellaneous-1.1.0/lauchli.m b/octave_packages/miscellaneous-1.1.0/lauchli.m new file mode 100644 index 0000000..3f65737 --- /dev/null +++ b/octave_packages/miscellaneous-1.1.0/lauchli.m @@ -0,0 +1,32 @@ +## -*- texinfo -*- +## @deftypefn {Function File} {@var{a}} = lauchli (@var{n}) +## @deftypefnx {Function File} {@var{a}} = lauchli (@var{n},@var{mu}) +## Creates the matrix [ ones(1,@var{n}); @var{mu}*eye(@var{n}) ] +## The value @var{mu} defaults to sqrt(eps). +## This is an ill-conditioned system for testing the +## accuracy of the QR routine. +## +## @example +## @group +## A = lauchli(15); +## [Q, R] = qr(A); +## norm(Q*R - A) +## norm(Q'*Q - eye(rows(Q))) +## @end group +## @end example +## @end deftypefn +## @seealso {ones,zeros,eye} + +## This program is in the public domain +## Author: Paul Kienzle + +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