All problems
Orthogonal Iteration Step
Problem
Perform one step of orthogonal iteration (subspace iteration) on A with orthogonal matrix Q:
Compute Z = A*Q, then orthonormalize the columns of Z with Gram-Schmidt and return the new orthogonal matrix Q_new.
Hint
Repeated orthogonal iteration converges to the dominant invariant subspace.
Test cases
case 1
in: [[[1,0],[0,1]],[[1,0],[0,1]]]
expected: [[1,0],[0,1]]
case 2
in: [[[2,0],[0,1]],[[1,0],[0,1]]]
expected: [[1,0],[0,1]]
case 3
in: [[[1,1],[0,1]],[[1,0],[0,1]]]
expected: [[1,0],[0,1]]
case 4
in: [[[0,1],[1,0]],[[1,0],[0,1]]]
expected: [[0,1],[1,0]]
Starter codePython
def orthogonal_iteration_step(A, Q):
# Your code here
pass4 test cases · run your code against them in the editor