I see inconsistencies between dgesvd and MATLAB svd.

Hi,

I am using LAPACK dgesvd to compute the SVD of a real-valued Hankel matrix as a part of my C program and am comparing the results obtained against the MATLAB function SVD. I notice that while the worst difference between the singular values is of the order of 10^-6 or 10^-7 for various cases (which isn't too bad); as the matrix size increases, the worst difference between the left and right singular vector matrices from LAPACK and MATLAB starts increasing, reaching as high as ~0.08. I was also accounting for the possibility of sign differences while computing the differences(i.e. (-U)*S*(-V') also being a valid solution) . From what I was able to find, MATLAB also uses the dgesvd function internally. Could someone guide me as to what would lead to the larger differences between the singular vector and why these differences are not reflected in the singular values? MATLAB possibly does some preconditioning internally to improve its accuracy. Any suggestions for me to improve the accuracy obtained from LAPACK?

Side notes: The condition number of the matrix in general worsens as the matrix size grows, reaching about 10^10 for a 400x400 matrix. Also, I can confirm that MATLAB's solution is more accurate by finding the difference between the matrix and U*S*V' for the two approaches. While the accuracy of MATLAB's solution is always 10^-11 or better; that obtained from LAPACK is always worse than 10^-5, worst case being about 0.0177