matlab: having generated a krylov space of a[v, h] = arnoldi(a, v1, m) now having only v and h (not a), update them after you had been adding dak to the kth column of a. in matlab

To update the Krylov subspace representation of a matrix A after adding d*A(:,k) to the k-th column of A, you can update the Hessenberg matrix H and the matrix of basis vectors V without having to directly store or work with the matrix A.

You can achieve this by simply updating the Hessenberg matrix H, and the basis vectors matrix V using the following operations:

main.m
% Update using the Krylov matrix and the new vector
H(:,k) = H(:,k) + d*V'*v; % Update the k-th column of H
v = A*v - H(:,k)*d;      % Update the new vector v

[V(:, end + 1), H(:, end + 1)] = arnoldi(A, v, 1); % Add the updated v to V and compute the new column of H
268 chars
6 lines

Make sure to update the corresponding k-th column of the matrix H by adding the appropriate value as well.

related categories

gistlibby LogSnag