forum.alglib.net

ALGLIB forum
It is currently Fri May 24, 2024 3:08 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Pseudo Inverse from SVD routine
PostPosted: Fri Jun 18, 2010 7:28 pm 
Offline

Joined: Fri Jun 18, 2010 7:17 pm
Posts: 4
Hi,
I am trying to find a pseudo inverse of a general M x N matrix (M >= N).
Here are my steps
1) rmatrixSVD to derive U S V' where U is left-singular vectors, S is eigen-vectors, V is right-singular vectors
2) Excluding eigen value of "0", I am constructing pseudo inverse in this form V * S^-1 * U'

Everything went fine and I am checking the moore-penrose conditions
1) (Pseudo A) * A * (Pseudo A) = (Pseudo A) and
2) A * (Pseudo A) * A = A

Somehow, condition 2 fails from time to time, here is an example of matrix that fail
-1 -1 3
1 -2 2
(1/3) 1 (-1/3)
(-1/4) 1 (1/4)
0.1 0.5 0.5

Just wondering if someone can shine some light into how I am doing wrong?

Thank you

P.S. This library is excellent.


Top
 Profile  
 
 Post subject: Re: Pseudo Inverse from SVD routine
PostPosted: Sun Jun 20, 2010 8:26 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 915
I've checked SVD on this matrix - it works OK. Furthermore, (2) is seems to be true.

How large is difference between A and A*(Pseudo A)*A? Differences as large as 1.0E-14*max(S[]) are normal.


Top
 Profile  
 
 Post subject: Re: Pseudo Inverse from SVD routine
PostPosted: Mon Jun 21, 2010 4:55 pm 
Offline

Joined: Fri Jun 18, 2010 7:17 pm
Posts: 4
Thanks Sergey for your response.
It is quite large. It is in the order of 0.2.
I think I may have executing the API wrong considering it only meets one of two conditions.

If you don't mind, can you give me the listing you have used to test the matrix. I am using C# but you can give me the listing in any language.

Thanks again. BTW. did I mention your library is awesome?


Top
 Profile  
 
 Post subject: Re: Pseudo Inverse from SVD routine
PostPosted: Mon Jun 21, 2010 8:58 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 915
barggio wrote:
It is quite large. It is in the order of 0.2.
I think I may have executing the API wrong considering it only meets one of two conditions.

It is possible. Another possibility is that some C#-specific bug exists. Could you post here results from rmatrixsvd() and pseudoinverse you've calculated using these results? You can also post your code for pseudoinverse calculation.

barggio wrote:
If you don't mind, can you give me the listing you have used to test the matrix. I am using C# but you can give me the listing in any language.

I've used C++ to calculate SVD, then I copied it in Excel and played with its matrix multiplication capabilities. I'll post them tomorrow (+10 hours). They are stored in another machine which I can't access now.

barggio wrote:
Thanks again. BTW. did I mention your library is awesome?

I've tried my best :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group