I'm working with large sparse matrices and small sparse matrices.
Now, the eig
command doesn't work with sparse matrices (when using sprand
) so I must use eigs
.
But I have a script that needs to use both depending on what matrix I'm using. I could have two identical scripts, one with eig
the other eigs
(and 5,6 <=> N-1,N) but I'd like to know how to combat this.
Here is the start of my script.
f=eigs(A); % was eig
figure(1)
semilogy(res) %
convfact = abs(f(5))/abs(f(6)); % 5,6 was N-1 and N respectively
hold on
semilogy(convfact.^(1:k),'r--')
I'd also like to point out, for when I'm using the eig
command, as the comment in the code says, the 5 and 6 was the N-1 and N. But obviously MATLAB can't find these values on a 0000x0000 matrix so I must use the 5th and 6th that eigs
provides.
Any advice on solving this will be great, thanks.