I wrote a python code to find largest eigen value n corresponding eigen vector using power method for a NON-SYMMETRIC matrix. I could get correct answer with this.
Now, I want to find the 2nd largest eigen value and corresponding eigen vector for the same NON-SYMMETRIC matrix..I tried deflation technique but couldn't get correct answer. How to apply deflation techniques for NON-SYMMETRIC matrices?
There is an example on here of the QR iteration with deflation.
In general the QR algorithm without shifts takes a matrix $A$
$$A^{0} = A \tag{1} $$
$$ \textrm{ for k = 1,2 } \cdots $$
$$Q^{k}R^{k} = A^{k-1} \tag{2} \textrm{ QR factorization } $$
$$ A^{k} = R^{k}Q^{k} \tag{3} \textrm{ recombine in reverse} $$
This is a matlab implementation it requires two other scripts.
This script is the givens hessenberg reduction
This script zeros it.
Most of what you have to do is change the arrays with numpy.