Spurious complex eigenvalues caused by roundoff.
显示 更早的评论
Hi everyone,
I found this piece of code in the MATLAB stats toolbox, file cmdscale.m
P = eye(n) - repmat(1/n,n,n);
B = P * (-.5 * D .* D) * P;
[V E] = eig((B+B')./2); % guard against spurious complex e-vals from roundoff
I understand that B+B'./2 is a common idiom of making a matrix symmetric, but I don't understand what dangers this is guarding against. Is it something to do with the computation of B? It's given that D is a symmetric matrix, so by definition B should be too. Perhaps very small values in the off-diagonal positions round to different values and this is a guard for that. What I don't understand is why this symmetric operation isn't itself susceptible to round-off errors. I don't have any intuition as to what's happening. Any comments or references to the literature would be most appreciated.
Thank you for your time,
Charles.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Subspace Methods 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!