MatLab eig vs LAPACK

14 visualizzazioni (ultimi 30 giorni)
Lennart Sinjorgo
Lennart Sinjorgo il 24 Nov 2022
Modificato: John D'Errico il 24 Nov 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?

Risposta accettata

John D'Errico
John D'Errico il 24 Nov 2022
Modificato: John D'Errico il 24 Nov 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.

Più risposte (0)

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by