There is no clear answer, since this depends on many factors: - Are your matrices dense or sparse, and if they are sparse, how sparse and with what sparsity structure? - Are the eigenvalues clustered closely together?
If we're assuming that all your matrices are dense and nicely conditioned, we can just try it out using random matrices (note that the performance here is also machine-dependent):
rng default;
A = randn(n);
A = A+A';
B = randn(n);
B = B*B';
tic;
[U, D] = eig(A, B);
toc
tic;
[U, D] = eigs(A, 1, 'smallestabs');
toc
For n = 1000, EIGS is faster:
Elapsed time is 0.181162 seconds.
Elapsed time is 0.039232 seconds.
For n = 200, they take comparable amounts of time:
Elapsed time is 0.016852 seconds.
Elapsed time is 0.011491 seconds.
For n = 100, EIG is faster:
Elapsed time is 0.004331 seconds.
Elapsed time is 0.036057 seconds.
Even for sparse matrices, I'd typically use EIG instead of EIGS for n<100.
Best Answer