Filter löschen
Filter löschen

how to compute orthonormal vectors via Lanczos process?

1 Ansicht (letzte 30 Tage)
Omar B.
Omar B. am 27 Aug. 2019
Hello,
How to initialize vector in Matlab? could you please check what I did ( I want to start with V_0=0 , beta (0)=0 , V(:,1) = V/norm(V,2))
Also, how can we creat a matrix collect all V's we have found ? ( i.e Q=[ V_1 V_2 ... V_j+1] )
My code:
function [] = lanczos(A, m)
[n,k] = size(A);
V(:,0)=0;
V(:,1) = ones(k,1);
V(:,1)=V(:,1)/norm(V(:,1),2);
beta(0)=0;
for j=1:m
w = A*V(:,j) - V(:,j-1)*beta(j-1);
alpha(j-1) = V(:,j)'.* w;
w = w - V(:,j)* alpha(j-1);
beta(j) = norm(w,2);
V(:,j+1) = w/beta(j);
end

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by