Hello,

I have encountered an issue with the DGESVD routine in LAPACK that I don't quite know how to resolve.

I am attempting to compute the singular value decomposition of a matrix whose entries are small. I can compute the singular values in MATLAB with the svd() function, and I get correct answers. However, when using DGESVD in a MATLAB mex function, only the first singular value is correct.

I suspect that it has to do with the fact that the singular values are small and far apart. MATLAB's results for my test matrix give the following as the singular values:

6.725622826239752e-023

4.355711003542524e-040

8.444188487308763e-042

4.893839131447302e-042

Obviously, relatively speaking, the second value is under the traditional double-precision machine epsilon relative to the first value.

Is there a way to balance or scale the matrix to avoid this issue?