- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using dgesdd for SVD calculations and recently was trying to upgrade the MKL version from 2019.2.190 to 2024.0
I observed that there is numerical difference in the calculation for dgesdd in these versions.
e.g. if your input matrix A is,
7.52 -1.1 -7.95
-0.76 0.62 9.34
5.13 6.62 -5.66
in 2019.2.190 we get,
u =
-0.519406 -0.161058 0.839212
0.293901 0.888495 0.352418
0.802396 -0.429694 0.414155
s =
15.6921 6.68311 4.52026
vt =
-0.662788 -0.234761 0.711055
0.518296 0.541528 0.661904
-0.540445 0.807239 -0.237242
While in 2024.0 we get,
u =
-0.519406 -0.161058 0.839212
-0.293901 -0.888495 -0.352418
0.802396 -0.429694 0.414155
s =
15.6921 6.68311 4.52026
vt =
-0.662788 0.234761 0.711055
0.518296 -0.541528 0.661904
-0.540445 -0.807239 -0.237242
The highlighted numbers have opposite signs in each version.
Could you just explain if this is real error? is there any change in these 2 versions?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Aniket,
Thank you for posting the issue.
Can you try the latest version(oneMKL 2025.1.0)? And provide out your platform information, such as CPU info, OS, etc, as well as a simple reproducer?
Regards,
Ruqiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm checking newer versions. Currently having issues in building one.
Running on RH8, gcc13.2. I can create a simple program to give you the testcase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There seem to be a typo that u should be vt while vt should be u, otherwise A != u*s*vt.
SVD is not unique. Both results are numerically correct. They are just computed using different algorithms.
The sign of the second column of u flips <=> u*diag([1 -1 1]), where diag([a b c])=[a 0 0; 0 b 0; 0 0 c]. The sign of the second row of vt flips <=> diag([1 -1 1])*vt. If we multiply them together, u*diag([1 -1 1])*s*diag([1 -1 1])*vt = u* (diag([1 -1 1])*s*diag([1 -1 1])) *vt = u * s * vt in the case that s is a diagonal matrix. Therefore these two decompositions represent the same A matrix.
If it is a concern, could you provide more details how the result of SVD is used?
Thanks,
Fengrui
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Fengrui,
Thanks for the response!
When you say they are computed using different algorithms, is there any way we can select the algorithm used by older mkl versions?
I'm using these in complex matrix operations and the final numbers are very different than the expected. so I believe this could be multiple dependent calculations leading to wrong final number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To select algorithms used in older mkl applications you should install the older version and link against the older library.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page