MatLab eig vs LAPACK

15 ビュー (過去 30 日間)
Lennart Sinjorgo
Lennart Sinjorgo 2022 年 11 月 24 日
編集済み: John D'Errico 2022 年 11 月 24 日
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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by