Skip to content
DeepForgeby svx
All problems
HardLinear Algebrala-271

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
    pass

4 test cases · run your code against them in the editor