I have a running program with the Lanczos algorithm in Martlab and I am trying to convert it to Python. I have the following problem:
in Matlab I have the following loop:
beta(2)=0;
for j=2:m+2
w = A*V(:,j) - beta(j)*V(:,j-1);
alpha(j) = w'*V(:,j);
w = w - alpha(j)*V(:,j);
beta(j+1) = norm(w,2);
V(:,j+1) = w/beta(j+1);
end
I have implemented that the following way in Python:
beta(2)=0
for j in range [2: m+2]:
w=A*V[:,j] - beta(j)*V[:,j-1]
alpha(j)=w.transpose()*V[:,j]
w = w - alpha(j)*V[:,j]
beta(j+1)=norm(w,2)
V[:,j+1]= w/beta(j+1)
The problem is I keep getting the error message SyntaxError: “can't assign to function call”. What could be the possible reason I keep getting this error message? It's not an indentation problem.
Thanks!