Inverse iteration algorithm for eigenvalues (and eigenvectors)
Implement the inverse iteration algorithm that calculates the eigenvalue that is closest to the given shift-value s (and the corresponding eigenvector) of the given symmetric matrix A. Use your own linear algebra routines.
Inverse iteration algorithm allows calculation of the eigenvalue (and the corresponding eigenvector) that is closest to a given value. Read the book and/or the [inverse iteration] article in Wikipedia.
The interface could be like this (check everything),
(double,vector) inverse_iteration (matrix A,double s,vector x0=null) : if x0==null : x0 = random_vector Q,R = qrdecomp(A-s*1) x1 = qrsolve(Q,R,x0) λ1 = s + (x1•x0)/(x1•x1) do : x0 = x1 x1 = qrsolve(Q,R,x0) λ0 = λ1 λ1 = s + (x1•x0)/(x1•x1) if abs(λ1-λ0) < acc : break while true return (λ1,x1)