Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!j19g2000vbp.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: inverse matrix inv pinv linfactor ginv
Date: Sun, 4 Oct 2009 06:21:43 -0700 (PDT)
Organization: http://groups.google.com
Lines: 46
Message-ID: <6ed887e5-8dc1-4d0d-8d96-ef4ac3c7b5c7@j19g2000vbp.googlegroups.com>
References: <ha8r6f$pf7$1@fred.mathworks.com>
NNTP-Posting-Host: 77.17.201.98
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1254662503 10058 127.0.0.1 (4 Oct 2009 13:21:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 4 Oct 2009 13:21:43 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: j19g2000vbp.googlegroups.com; posting-host=77.17.201.98; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
	Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; 
	.NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:574792


On 4 Okt, 02:45, "leo nidas" <bleonida...@yahoo.gr> wrote:
> Hi there,
>
> I want to solve or b the : (X'X)*b=X'*y. I have some issues with the inverse of X'*X.

Find a book on elementary linear algebra, read it,
contemplate it, and then use the ages-old standard way
to handle these things:

b = inv(X'X)X'y

Compute the SVD of X:

X = USV where S = diagonal, U'U = UU' =I, V'V = VV'= I

Insert in the expression to find

b = V'inv(S)U'y.

Since S is diagonal, S^-1 is easily computed.

Now, the matlab function PINV does all this,
so if you want a canned routine you can use it.
However, by writing this out in full, you can get
a useful solution by inspecting the elements on
the diagonal of S:

If |s(n,n)| ~ 0 for some n, the corresponding
term does not contribute in the data model.
However, the corresponding term 1/s(n,n) totally
dominates the pseudo inverse.

So in the pseudo inverse you will want to skip
all terms with singular values smaller than some
tolerance.

PINV does this, with the TOL argument that you
as user have to provide in advance - I suspect this
is an absolute tolerance. I would prefer a relative
tolerance, like

RTOL = eps('double')*max(diag(S));

in which case you will have to roll your own.

Rune