When eigs uses a custom function as input, it cannot compute an eigenvalue near a specified sigma
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
As the title says, the eigs function is used to compute the eigenvalues of a 10 by 10 symmetric matrix, specify a sigma, and obtain several eigenvalues near the sigma.
The following three methods are used, the first is to solve the first five smallest eigenvalues, the second is to specify a sigma, calculate the five nearby eigenvalues, this method is no problem.
However, the third method, which turns the matrix into a custom function input to the eigs and calculates the eigenvalues near sigma, results in an error, and does not get the correct eigenvalues, the results are some numbers close to sigma.
n = 10;
A = randn(n);
A = A + A';
while rank(A) < n
A = randn(n);
A = A + A';
end
[V1,E1]=eigs(A,5,'sa');
sigma = E1(2,2)+1;
[V2,E2]=eigs(A,5,sigma);
[V3, E3] = eigs(@(x) customFunction(A, x), size(A, 1), 5, sigma);
digits = 3;
E1 = round(E1, digits)
E2 = round(E2, digits)
E3 = round(E3, digits)
function y = customFunction(A, x)
y = A*x;
end
1 comentario
Christine Tobler
el 13 de Mzo. de 2024
When EIGS uses a custom function and the mode is not "largestabs", this custom function must solve a linear system with the matrix A, shifted by sigma. See the doc.
You can also use the "Display" option which will tell you what EIGS assumes your function handle is computing.
Ver también
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!