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
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 Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!