Hi Zhao,
Your understanding of StartVector in eigs appears to be generally accurate, there are various considerations and potential optimizations to explore further to address the efficiency issue you are experiencing. After analyzing your code snippet, the elapsed times for computing eigenvectors with and without the StartVector are quite close, indicating that the initial guess (v1) might already be close to the actual eigenvector. This scenario explains why there is no noticeable time improvement when using the StartVector. To enhance efficiency using StartVector, consider scenarios where the initial guess is far from the actual eigenvector, leading to quicker convergence. Also, experimenting with different initial guesses or refining the eigenvector computation process may yield more noticeable efficiency gains. I made some changes to your code snippet to make it more efficient in terms of computation time as it eliminates the need for the test_eigs function and achieves faster results but feel free to customize it based on your needs.
format long
% Define matrix A n = 3000; A = rand(n,n); A = A + A';
% Compute eigenvector v1 without StartVector tic [v1, eta1] = eigs(A, 1, 'lm', 'Display', 0); toc
% Use eigenvector v1 as StartVector for eigs StartVector = v1; tic [v2, eta2] = eigs(A, 1, 'lm', 'Display', 0, 'StartVector', StartVector); toc
% Display eigenvalues eta1 eta2
Please see attached results.
Please let me know if you have any further questions.