matlab coding for simple subspace iteration
6 views (last 30 days)
Show older comments
I wrote the code for the simple subspace iteration but it does not seem to work properly. Here is my code
function [v,lamda] = SSI(A,tol)
n=size(A,1);
v=rand(n);
res=1;
while (res > tol)
W = A*v;
[Q,R] = qr(W);
v = Q;
res = norm(W-A*v);
end
and the algorithm is as follows
Choose an initial system of vectors v_{0}
Iterate: Until convergence do,
v_{k} = Av_{k-1}
v_{k} = QR the QR factorisation of v_{k} and set v_{k} = Q
Thanks in advance
1 Comment
Geoff Hayes
on 3 May 2014
Edited: Geoff Hayes
on 3 May 2014
Please clarify what is meant by "…does not seem to work properly". What exactly doesn't work properly in your algorithm? Is the error something like "not all output parameters are set"? The output parameter lambda is not being set to anything so that could be a problem. Else this code looks awfully similar to ssi problem.
Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!