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 a vector dak to the kth column of a. in matlab

You can update the Krylov subspace represented by (V) and (H) after adding a vector (dak) to the (k^{th}) column of the original matrix (A) as follows in MATLAB:

main.m
% Update h matrix
h(k, :) = h(k, :) + (v' * dak)';

% Update the v matrix
v = [v, (A * v(:, end) - h(end, end) * v(:, end) - dak) / h(end, end)];
146 chars
6 lines

In the code above:

  • (v) is the matrix containing the basis vectors of the Krylov subspace,
  • (h) is the upper Hessenberg matrix containing information about the Arnoldi decomposition,
  • (dak) is the vector you're adding to the (k^{th}) column of the original matrix (A),
  • (A) is the original matrix from which the Krylov subspace was generated.

You can update the (h) matrix directly by adding the inner product of (v) and (dak) to the (k^{th}) row of (h). Then, you can update the (v) matrix by extending it with the new vector obtained using the formula given above.

Remember to adjust the indices according to the 1-based indexing in MATLAB if necessary.

main.m
0 chars
1 lines

related categories

gistlibby LogSnag