Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 16 Jul 2007 21:43:31 -0500
Date: Mon, 16 Jul 2007 22:43:29 -0400
From: "Robert E. Beaudoin" <rbeaudoin@comcast.net>
Reply-To:  rbeaudoin@acm.org
User-Agent: Thunderbird 2.0.0.4 (X11/20070616)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab,comp.dsp
Subject: Re: Is a QR Decomposition Better than B \ A?
References: <m3zm21orrv.fsf@ieee.org> <beKdnfxrAJqp7wfbnZ2dnUVZ_oa3nZ2d@comcast.com> <m34pk42wbg.fsf@ieee.org> <1184626471.779490.291280@n60g2000hse.googlegroups.com> <1184626658.984961.23040@22g2000hsm.googlegroups.com> <m38x9fdgjl.fsf@ieee.org>
In-Reply-To: <m38x9fdgjl.fsf@ieee.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <WYadnZfzv4JOsQHbnZ2dnUVZ_hKdnZ2d@comcast.com>
Lines: 54
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 65.96.175.215
X-Trace: sv3-Enao2p5Wnpl2bcH4MnUJwuBaVM6cyw9G6ibAc08QayJRPB76Pe0FIDWM4SEgNecdjPDgV3q0+tfh/ba!GIy88mYgn5pCafJwSVFTymglb4TGrXZ48T0zqFf1fPgoDyply8+D0hT1Xz6hXfFywyw1s75ibUJj!z5PUHewLG2d+Gnv4LKmM1UljnS4/3w==
X-Complaints-To: abuse@comcast.net
X-DMCA-Complaints-To: dmca@comcast.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.35
Bytes: 3512
Xref: news.mathworks.com comp.soft-sys.matlab:419433 comp.dsp:225502



Randy Yates wrote:
> Clay <physics@bellsouth.net> writes:
>> [...]
>> 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
> 
> As Robert said, that's only good if A is non-singular, and it ain't
> necessarily in my application.
> 
> I know these are all least-squares solutions. I'm asking which ones are
> "better." That is, which one provides a smaller squared-error? 

According to the Matlab help pages (I'm looking at them via the web as I 
  don't have a Matlab installation at home, so I think they apply to the 
latest Matlab release) either mldivide or pinv will return a 
least-square solution.  That means they both return a solution 
minimizing the (squared) error.  So when the least-square solution is 
unique they will return the same answer (within round-off error).  But 
if A is n-by-m with n > m > rank(A) there can be more than one solution 
minimizing the squared error; in that case A\b returns a least-square 
solution with no more nonzero entries than the rank of A, whereas 
pinv(A) * b is a least-square solution which itself has minimum norm 
(among all least-square solutions).  The Mathworks docs give the example

A = [ 1  2  3
       4  5  6
       7  8  9
      10 11 12]

b = [2 5 8 11]'.

The minimum squared error is zero, an obvious least-square (i.e. exact) 
solution is [0 1 0]', but A\b yields the least-square solution
[1/2  0  1/2]' whereas pinv(A) * b yields the least-square solution
[1/3  1/3  1/3]'.

Normally you wouldn't really care which of these you get; as a practical 
matter A\b is likely to be faster than pinv(A) * b but could give you 
annoying warning messages if A is rank-deficient (as in this example).
Depending on your application this rank-deficient case may never arise.

Hope that helps.  I'll be traveling for the rest of this week, so I 
won't be able to answer any further questions for a while.

Robert E. Beaudoin