From: "John D'Errico" <woodchips@rochester.rr.com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: Is a QR Decomposition Better than B \ A?
Message-ID: <ef5d562.3@webcrossing.raydaftYaTP>
Date: Fri, 13 Jul 2007 18:15:17 -0400
References: <m3zm21orrv.fsf@ieee.org> <ef5d562.0@webcrossing.raydaftYaTP> <m3k5t43t2p.fsf@ieee.org>
Lines: 87
NNTP-Posting-Host: 66.66.16.32
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:419010



Randy Yates wrote:
>
>
> "John D'Errico" <woodchips@rochester.rr.com> writes:
>
>> Randy Yates wrote:
>>>
>>>
>>> If we have a system of equations Ax=b, then we can solve it
> using
>>>
>>> x = A \ b
>>>
>>> or
>>>
>>> x = pinv(A'*A)*A'*b
>>
>> NO. NO. NO!!!!
>>
>> Why do people persist in using this form?
>
> Because it's what you see in the linear algebra books and it's so
> cool
> in theory?

No, actually its pretty poor in theory,
once you get into the theory.

And, I seriously hope that you will
not find an expression like

  pinv(A'*A)*A'*b

in any recent linear algebra text
worth reading. This shows a lack of
understanding of what pinv does. Why
is it poor? Pinv uses a SVD. But if
you were going to go to the effort
of computing a SVD, applying it to
A'*A squares the singular values.
This loses lots of precision, half
your digits go away into the bit
bucket. At this point there seems
little purpose in throwing a
pseudo-inverse at it. If you were
worried about singularity before,
then why square the singular values?

Yes, old texts do tend to have the
normal equations form:

  inv(A'*A)*A'*b

As I said, its a poor thing to do
with inv or pinv.

>
> To Meyer's credit, he mentions that it's a bad thing to do
> numerically
> in his text and had the QR method as a suggested alternative.

Good.

(snip)

>>> Which is best?
>>
>> Each is different, with different properties.
>> I talk about some of those differences
>> in my tips and tricks doc.
>>
>> <http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8553&objectType=FILE>
>
> I appreciate the resource, but I must admit the format is so
> unconventional that I had a hard time viewing it even using
> Matlab. Why not prepare a simple pdf instead of embedding
> documentation (including specific font information) in the m
> files?

The idea is as an m-file you can change
things and see what happens. Its fully
executable in Matlab. I've considered
moving it to LaTeX/pdf, but then its
just another book to read.

John