MatLab eig vs LAPACK

14 visualizaciones (últimos 30 días)
Lennart Sinjorgo
Lennart Sinjorgo el 24 de Nov. de 2022
Editada: John D'Errico el 24 de Nov. de 2022
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?

Respuesta aceptada

John D'Errico
John D'Errico el 24 de Nov. de 2022
Editada: John D'Errico el 24 de Nov. de 2022
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.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by