My matrix $M$ is huge, but I know that $1$ is an eigenvalue.
I need to extract the corresponding eigenvector, which corresponds to this eigenvalue $\lambda=1$.
There could be $1000$ other eigenvalues, but I need only to know what happens for $\lambda=1$
I currently set up an if procedure, which evaluates all 1000, checks if it's eigenvalue is 1, if true then print the result. However this is taking forever to run for big matrices.
Can somebody help me out with an efficient code? I should use the LinearAlgebra[EigenVectors] command.
I was thinking something along eval (eigenvalue - 1)<0.01, then evaluate the vector. But I can't seem to put it into code.
An implementation of the nullspace approach suggested by user251257 is simply:
use LinearAlgebra in v := NullSpace(M-IdentityMatrix(RowDimension(M))) end use;Another, costlier approach is to use the output=list version of Eigenvectors; of course, this is only worth doing if you need to associate many or all eigenvalues with their corresponding eigenvectors.
From the help page for LinearAlgebra:-Eigenvectors:
So compute
Eigenvectors(M, output=list), and process the result elementwise. To find the eigenvector corresponding an eigenvalue of 1, just find the sublist whose first element is 1.