This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen SVD versus others numerical tools

Tags: None
(comma "," separated)
nelsons
Registered Member
Posts
23
Karma
0
Hi,

If i try to compute svd with Eigen (with and without lapacke):

Example:

m = [ 0.68 0.597
-0.211 0.823
0.566 -0.605]

[U, S, V] = svd(m)

Eigen::BDCSVD<Eigen::MatrixXd> svd(matA, Eigen::ComputeFullU | Eigen::ComputeFullV);
// or Eigen::JacobiSVD<Eigen::MatrixXd> svd(matA, Eigen::ComputeFullU | Eigen::ComputeFullV);
matU = svd.matrixU();
matV = svd.matrixV();

Eigen returns for U:

U =

0.3883 0.8657 -0.3159
0.7113 -0.0636 0.7000
-0.5859 0.4965 0.6405

V =

-0.1826 0.9832
0.9832 0.1826

But in Octave and others similar tools returns:

>> [U, S, V] = svd(m)
U =

-0.388338 0.865677 -0.315907
-0.711313 -0.063649 0.699987
0.585856 0.496541 0.640484

V =

0.18260 0.98319
-0.98319 0.18260

Does I miss an compilation options or a choice of Eigen ?
Why Eigen does not return same values ?

Thanks
raman
Registered Member
Posts
8
Karma
0
OS
Both answers are correct. The SVD is not unique (columns of U can flip sign if same column of V do too).
nelsons
Registered Member
Posts
23
Karma
0
raman wrote:Both answers are correct. The SVD is not unique (columns of U can flip sign if same column of V do too).


Hi,

Yes, I know this but why not return same results than all others standard tools ?

It could be clearly easier for users ...
I mean I have an algo in octave or others and when I use Eigen I expect to have exactly the same result and not to justify why it is also good ...

And as Eigen can use blas/lapack as octave, it should be the same result ...

Thanks


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]