matlab coding for simple subspace iteration

6 次查看(过去 30 天)
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 个评论
Geoff Hayes
Geoff Hayes 2014-5-3
编辑:Geoff Hayes 2014-5-3
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by