Step 2 find the largest and smallest
[p1,s1]=eig(A);[P,D]=sortem(p1,s1);lmin = D(n,n)lmax = D(1,1)
Step 3 Initialization
l=2; % Number of lanczos iteration that we want
l=l+2; % change because of the algorithm
%b = A*ones(n,1);
b = P(:,1)tol = 10e-8x0 = zeros(n,1)[x,r,bg,bgrl,bgru,bgl] = CGQL(A,b,x0,n,lmin,lmax,tol,l);When I run this program(above code is just the part of the program) I'm getting this error when b=P(:,1)
Error in ==> CGQL at 24 x(:,1) = x0;
??? Output argument "bg" (and maybe others) not assigned during call to "/home/meerkat/Desktop/Work/Golub/CG/CGQL.m>CGQL".
But when i change b=A*ones(n,1) (commented in the above code) it will run I'm not getting what error is this as the dimension of the matrix A and P are same.
Best Answer