Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail
From:  Clay <physics@bellsouth.net>
Newsgroups: comp.soft-sys.matlab,comp.dsp
Subject: Re: Is a QR Decomposition Better than B \ A?
Date: Mon, 16 Jul 2007 15:57:38 -0700
Organization: http://groups.google.com
Lines: 93
Message-ID: <1184626658.984961.23040@22g2000hsm.googlegroups.com>
References: <m3zm21orrv.fsf@ieee.org>
NNTP-Posting-Host: 64.244.79.130
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1184626659 16859 127.0.0.1 (16 Jul 2007 22:57:39 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 16 Jul 2007 22:57:39 +0000 (UTC)
In-Reply-To: <1184626471.779490.291280@n60g2000hse.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Q312461),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: 22g2000hsm.googlegroups.com; posting-host=64.244.79.130;
Xref: news.mathworks.com comp.soft-sys.matlab:419421 comp.dsp:225487



On Jul 16, 3:54 pm, Clay <phys...@bellsouth.net> wrote:
> On Jul 16, 8:38 am, Randy Yates <ya...@ieee.org> wrote:
>
>
>
>
>
> > "Robert E. Beaudoin" <rbeaud...@comcast.net> 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
> > >> or
> > >>   [Q,R] = qr(A);
> > >>   x = inv(R)*Q'*b;
> > >> Which is best? Also, I thought a QR decomposition always produced a
> > >> nonsingular R
> > >> matrix [meyer, p.313], but Matlab is returning a non-square
> > >> matrix. Why?
> > >> --Randy
> > >> @BOOK{meyer,
> > >>   title = "{Matrix Analysis and Applied Linear Algebra}",
> > >>   author = "{Carl~D.~Meyer}",
> > >>   publisher = "Society for Industrial and Applied Mathematics",
> > >>   year = "2000"}
>
> > > Which alternative is "best" will likely depend on your application.
> > > The matlab function reference pages for mldivide, pinv, and qr will
> > > give you excruciating detail about the differences (and similarities)
> > > between the three.  In a nutshell, backslash-division will try to
> > > intelligently select a solution algorithm based on e.g. whether A is
> > > square or not, and sparse or not (and for non-square matrices it uses
> > > the QR decomposition) and will produce a solution with the minimum
> > > number of non-zero entries.  Using pinv (in the form  x = pinv(A) * b;
> > > the equation you give works too but why bother with the extra
> > > operations?) will give a solution with minimum norm.  Unless you know
> > > you want this I'd suggest using \ and letting Matlab do the thinking
> > > about which algorithm to use.
>
> > > As to your second question, it is the Q matrix which is guaranteed to
> > > be non-singular (even better, orthogonal).  R must always have the
> > > same size as A, and be singular if and only if A is.
>
> > Hello Robert,
>
> > Thank you for your help. I took another look at the matlab help page
> > for qr and I don't see any discussion of the differences or similarities.
> > the mldivide page does have some information. Perhaps I'm using an older
> > version than you (6.1.0.450 (R12.1))?
>
> > What I'm trying to ask is, which method gives me the minimum
> > squared error (minimum norm of residual)?
> > --
> > %  Randy Yates                  % "Remember the good old 1980's, when
> > %% Fuquay-Varina, NC            %  things were so uncomplicated?"
> > %%% 919-577-9882                % 'Ticket To The Moon'
> > %%%% <ya...@ieee.org>           % *Time*, Electric Light Orchestrahttp://home.earthlink.net/~yatescr-Hide quoted text -
>
> > - Show quoted text -
>
> Hello Randy,
>
> Are you looking for the least squared error solution to Ax=b, then
> solve
>
> x = (((A^t)A)^-1) *b
>
> where A^t is A transpose and ()^-1 is inverse
>
> if you let A = QR then you find
>
> x = (R^-1)(Q^t)b
>
> I hope this helps
>
> Clay- Hide quoted text -
>
> - Show quoted text -


Sorry  I didn't check it fully before sending

x = (((A^t)A)^-1)(A^t)b

or

x = (R^-1)(Q^t)b

will give LSQR solutions to Ax=b

Clay