Path: news.mathworks.com!not-for-mail
From: "Tim Davis" <davis@cise.ufl.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: inverse matrix inv pinv linfactor ginv
Date: Sun, 4 Oct 2009 12:06:01 +0000 (UTC)
Organization: University of Florida
Lines: 5
Message-ID: <haa339$1tk$1@fred.mathworks.com>
References: <ha8r6f$pf7$1@fred.mathworks.com>
Reply-To: "Tim Davis" <davis@cise.ufl.edu>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1254657961 1972 172.30.248.38 (4 Oct 2009 12:06:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 4 Oct 2009 12:06:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 45902
Xref: news.mathworks.com comp.soft-sys.matlab:574779


See my FACTORIZE code; it's very easy to use.  Also, posting a matrix with 5 digits of accuracy isn't a good idea.  It's too long for anyone to read, and even if someone wants to reconstruct your problem, they can't because you've tossed out about 11 digits in each number (which is where the problem may lie).

And you should never (well, almost never) do x=(A'*A)\(A'*b) to solve a least squares problem.  The only time you should do that is if you know your data is very well conditioned (not this case), and if A\b is slower than you'd like.  Cholesky on the normal equations can be faster than QR on A ... but of course that's useless if A'*A is horribly conditioned.

(The condition number of A'*A is the square of the condition of A, so if cond(A) is 1e8 you could hope to get 8 digits of accuracy in your result.   But cond(A'*A) is 1e16, so you get nothing in the result.)