Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

## SVD Single Precision Problem

New Contributor I
912 Views

There may be a bug in the SVD routines starting with version 2020 update 1 (v19.1.1) and later.

The problem (demonstrated in the attached code) is the reconstructed results are not correct for
single precision (real and complex) when using LWORK computed by the SVD routine.

The attached archive contains results generated using Intel Fortran v19.0.5, v19.1.0, v19.1.1, v19.1.2 on a MacBook Pro (3.1 GHz Intel Core i7). The results from using v19.0.5 and v19.1.0 are valid, but v19.1.1 and v19.1.2 generated similar inaccurate results.

The included code is based another message in this forum.

Thanks,
Nathan

4 Replies
Moderator
901 Views

Thanks for the report. It seems the problem has not been completely resolved. We will check the problem and keep the thread updated.

Thanks,

Gennady

Moderator
834 Views

Hello,

the SVD decomposition is not unique (more precisely singular values are unique but singular vectors might vary). Since that it is not correct to use a bit-to-bit comparison between two sets of singular vectors for different code branches. Thus the difference between two sets of the singular vector should be expected. According to the LAPACK User's Guide, the following conditions must be used to check the correctness of the SVD decomposition.

(1) | A - U S VT | / ( |A| max(M,N) ) =< const*ulp

(2) | I - U' U | / ( M ) =<const*ulp

(3) | I - VT' VT | / ( N ) =<const*ulp

(4) s(1)>= s(2) >= … s(min(M,N)) >=0

where ulp is the machine precision (it is about 1.e-8 for single precision), and const is a constant (300 is used in the Netlib Lapack unit tests).

So We've incorporated the computation of | A - U S VT | / ( |A| max(M,N) ) in the original code (see attached file named svd_fail_sr_mod.f90) and if we compile and run it) we'll see that the both code branches produce correct results.:

./a.out

..

tolerance 3.5762787E-05

The infinity norm of initial matrix 0.8196368

Infinity norm of the residual matrix in the 1st case 4.8623844E-13

Test passed

..

Infinity norm of the residual matrix in the 2nd case 1.6821372E-05

Test passed

>> So the accuracy is in admissible range for both cases.

New Contributor I
815 Views

Thanks for checking into and following up on this issue.

Moderator
808 Views

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.