MATLAB SVD vs. LAPACK dgesvd
3 次查看(过去 30 天)
显示 更早的评论
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. 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. Lastly, even for the largest matrix I tested, the smallest singular value is of the order of 10^-5 which is not really that small in comparison to machine precision.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Eigenvalues 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!