Why is 'eig' slower for tridiagonalized matrices ?

조회 수: 9 (최근 30일)
Douglas Gonçalves
Douglas Gonçalves 2016년 3월 1일
댓글: Douglas Gonçalves 2016년 3월 1일
Consider the list of commands below:
>> A = gallery('poisson', 60);
>>
>> tic; [V,D] = eig(full(A)); toc
Elapsed time is 16.074685 seconds.
>>
>> B = hess(full(A)); tic; [V,D] = eig(B); toc
Elapsed time is 28.709543 seconds.
>>
>>
Why does 'eig' take longer on the tridiagonalized version of A ?
This behaviour occurs with other matrices. I'm running MATLAB R2011b.

채택된 답변

Cam Salzberger
Cam Salzberger 2016년 3월 1일
Hello Douglas,
The brief answer is that it isn't anymore. In R2013a, there was an improvement in the handling of tridiagonalized matrices in "eig". Testing on my computer in R2011b and R2015b, I get:
R2011b:
eig(full(A)) - ~9 seconds
eig(B) - ~14.5 seconds
R2015b:
eig(full(A)) - ~3.7 seconds
eig(B) - ~0.6 seconds
I would recommend upgrading to the latest version of MATLAB, if you are able to.
-Cam
  댓글 수: 1
Douglas Gonçalves
Douglas Gonçalves 2016년 3월 1일
Thanks Cam,
I've just figured out that 'eig' in R2011b is calling DSYEV Lapack's routine. This routine has a scaling preprocessing step in which the input symmetric matrix is scaled based on its maximum absolute entry.
I guess the different scalings are making things harder to the QR algorithm in DSYEV.
The problem doesn't occur when calling DSYEVD Lapack's routine which implements a divide-and-conquer approach.
Thanks again for your answer. I'll try to update my MATLAB.
Douglas

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by