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.

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Pseudo Inverse from SVD routinePosted: Fri Jun 18, 2010 7:28 pm

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

 Post subject: Re: Pseudo Inverse from SVD routinePosted: Sun Jun 20, 2010 8:26 am

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

 Post subject: Re: Pseudo Inverse from SVD routinePosted: Mon Jun 21, 2010 4:55 pm

Joined: Fri Jun 18, 2010 7:17 pm
Posts: 4
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

 Post subject: Re: Pseudo Inverse from SVD routinePosted: Mon Jun 21, 2010 8:58 pm

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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 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 forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: