MatLab eig vs LAPACK

12 次查看(过去 30 天)
It appears that there exist some LAPACK function 'syevd' for computing the eigenvalue decomposition of dense symmetric matrices.
According to this (old) source, the syevd algorithm seems to be 5x times as fast as MatLab's eig.
When I tried to install this for myself, I ran into errors. It seems that this is rather outdated. Does anyone know if this speed difference is still this big? Or can anyone help me with getting the 'syevd' function to run in mex format?

采纳的回答

John D'Errico
John D'Errico 2022-11-24
编辑:John D'Errico 2022-11-24
If I had to guess, you don't need to use it.
A = randn(500);
timeit(@() eig(A))
ans =
0.0800828164545
B = A + A';
timeit(@() eig(B))
ans =
0.0064739664545
Do you see that eig ALREADY runs roughly 12 times faster on a symmetric matrix of the same size?
So I would bet the MATLAB eig checks for symmetry, and then uses an appropriate call to LAPACK. (The above test was performed using R2022b, update 1.) So your old source was just that - old, and out of date as long as you are using a current MATLAB release.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by