hillbig / redsvd

Automatically exported from code.google.com/p/redsvd
2 stars 1 forks source link

U is missing a colunm #8

Closed OdedHorowits closed 8 years ago

OdedHorowits commented 8 years ago

Hello, I just tried to check that redsvd results are ok, so I created a matrix A using knows U,S and V and then decomposed A using redsvd. The problem is that all the matrices created by redsvd are ok, except the fact that U is missing a column!

in order to run redsvd, I typed this caommand: redsvd -i A.txt -o A -r 4 -f dense -m SVD

Here are the know matrices:

U (5,5) 0.870674 -0.260900 0.142705 -0.376696 0.107674 -0.263355 0.234090 0.650987 -0.362331 0.566373 0.233879 -0.126663 0.344914 0.846487 0.306189 0.093526 0.224747 -0.655580 0.016423 0.714624 0.330340 0.900321 0.084269 0.100038 -0.251373

S (5,4) 0.697420 0 0 0 0 0.583092 0 0 0 0 0.450462 0 0 0 0 0.095441 0 0 0 0

V (4,4) 0.5297211 -0.7870401 0.2261944 0.2209060 0.0391979 0.3837411 0.4654601 0.7965885 -0.8032730 -0.4206469 0.4216526 -0.0042134 0.2694653 0.2374170 0.7445751 -0.5626984

A (5,4) = U * S * V 0.447990 -0.033294 -0.396519 0.195602 -0.146030 0.154127 0.213913 0.220716 0.197523 0.114727 -0.034784 0.096643 -0.135040 -0.083363 -0.232047 -0.172076 -0.280437 0.235758 -0.389924 0.209609

And here are the results of redsvd:

calc_V (4,4) -0.5297220 0.7870400 -0.2261940 0.2209060 -0.0391980 -0.3837420 -0.4654580 0.7965890 0.8032730 0.4206470 -0.4216530 -0.0042140 -0.2694650 -0.2374170 -0.7445760 -0.5626990

calc_s 0.697420 0.583092 0.450462 0.095441

calc_U (5,4) -0.870674 0.260900 -0.142705 -0.376696 0.263355 -0.234090 -0.650987 -0.362331 -0.233879 0.126663 -0.344913 0.846487 -0.093526 -0.224746 0.655580 0.016422 -0.330340 -0.900321 -0.084269 0.100038

and the original U, again:

U (5,5) 0.870674 -0.260900 0.142705 -0.376696 0.107674 -0.263355 0.234090 0.650987 -0.362331 0.566373 0.233879 -0.126663 0.344914 0.846487 0.306189 0.093526 0.224747 -0.655580 0.016423 0.714624 0.330340 0.900321 0.084269 0.100038 -0.251373

What is wrong?

and by the way, the answer given by redsvd for U,V must be a square matrices. That's the theory behind! A(m,n) = U (m,m) * S(m,n) * V'(n,n)

Thanks a lot!! Oded