All problems
Arnoldi Hessenberg Step
Problem
Perform one Arnoldi iteration step for matrix A and an orthonormal basis Q (list of orthonormal vectors).
Let q be the last vector of Q, compute w = A*q, subtract the projections h[i] = Q[i].w from w, and return [h, beta] where beta = ||w||_2 after orthogonalization.
Hint
The coefficients h fill one column of the upper Hessenberg matrix produced by Arnoldi.
Test cases
case 1
in: [[[2,0],[0,3]],[[1,0]]]
expected: [[2],0]
case 2
in: [[[1,2],[3,4]],[[1,0]]]
expected: [[1],3]
case 3
in: [[[1,2],[3,4]],[[0.7071067811865475,0.7071067811865475]]]
expected: [[5],2]
case 4
in: [[[2,1],[1,2]],[[1,0],[0,1]]]
expected: [[1,2],0]
Starter codePython
def arnoldi_step(A, Q):
# Your code here
pass4 test cases · run your code against them in the editor