Closed malloc82 closed 9 years ago
Just realized that U is transposed, different from matlab.
Hi Ritchie,
thanks for the report, I'd just like to go through this once to understand exactly what's going on.
So you were expecting to get back U' but in fact got U, or the other way around? I think svd should really return the untransposed U.
Concerning the signs, there is some freedom in which those are chosen, so that shouldn't be an issue.
Best,
-M
On Thu, Jan 8, 2015 at 7:54 PM, Ritchie Cai notifications@github.com wrote:
Closed #54 https://github.com/mikiobraun/jblas/issues/54.
— Reply to this email directly or view it on GitHub https://github.com/mikiobraun/jblas/issues/54#event-216084354.
Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun
Yes I was expecting the right matrix to be a U', since M = VSU', and that's usually what matlab returns. I was also testing it by multiplying V * S * [right matrix SVD returns], and couldn't get the original matrix back. Later I realize that the right matrix is already transposed, so it U instead of U', and that worked out OK. So it was confusion on my part. Thanks for replying.
I see. Very good.
Thanks for contacting me anyway!
-M
On Fri, Jan 9, 2015 at 1:54 PM, Ritchie Cai notifications@github.com wrote:
Yes I was expecting the right matrix to be a U', since M = VSU', and that's usually what matlab returns. I was also testing it by multiplying V * S * [right matrix SVD returns], and couldn't get the original matrix back. Later I realize that the right matrix is already transposed, so it U instead of U', and that worked out OK. So it was confusion on my part. Thanks for replying.
— Reply to this email directly or view it on GitHub https://github.com/mikiobraun/jblas/issues/54#issuecomment-69330672.
Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun
Summary: At the moment, svd function produces incorrect V and U matrice for both sparse and full. Singular value seems to be OK.
I was using clatrix, a clojure library interface with jblas, in my project, I needed all V, S and U (and I was looking for a matlab alternative). The svd function there was a direct call to jblas' svd, and The matrix I was using was a 434x32 matrix, the smallest data set comparing with others. By comparing with matlab result, a lot of the elements in V has different signs. And the norm of the result of (V_S_U - original_matrix) is almost a 1000, which is really really bad. Singular values, S, seems to be ok on that data set, but I didn't check with bigger data set.
Since clatrix calls jblas directly, so I figure I should report it here.