Eigs passes the wrong StartVector

3 visualizzazioni (ultimi 30 giorni)
Hi all,
I'm using MATLAB 2019b 64-bits. I'm calling eigs() to find the largest eigenvector of a matrix by passing it a function handle and specifying a 'StartVector' as follows:
A = reshape(1:9,3,3); % create some matrix for testing
StartVector = [0.4 0.9 1.7]'; % specify a start vector for eigs()
[vec,ev] = eigs(@(vec)test_eigs(vec,A),3,1,'largestabs','Display',0,'IsFunctionSymmetric',0,'MaxIterations',300,'StartVector',StartVector);
The definition of test_eigs() is as follows:
function vec = test_eigs(vec,A)
vec = A*vec;
end
However, eigs does not pass the specified start vector to the first call of test_eigs(). Instead, it passes the vector [1 0 0]' on all runs of the program. What am I missing? I'd appreciate any pointers!

Risposta accettata

Christine Tobler
Christine Tobler il 3 Dic 2021
The standard method used in EIGS is only efficient for matrices that are quite large. When eigs detects that the input matrix is so small that it will be more accurate and faster to just call EIG instead and extract the requested values from that, it does this instead and most options that affect the standard method's behavior are ignored as that method isn't used.
When a function handle is passed, this means that the function handle is just called on each column of the identity matrix one at a time, to get a matrix representation that can be passed to EIG.
If you increase the size of the input matrix, you'll see the 'StartVector' be passed in on the first call to the function handle:
n = 21;
A = ones(n);
StartVector = flip(1:n)';
[vec,ev] = eigs(@(vec)test_eigs(vec,A),n,1,'largestabs','MaxIterations',300,'StartVector',StartVector);

Più risposte (0)

Categorie

Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange

Tag

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by