All problems
Inverse Power Method Step
Problem
Perform one inverse power iteration step on the 2x2 matrix A with shift mu and vector v:
Solve (A - mu*I) * y = v, then return the unit vector y / ||y||_2.
Return None if (A - mu*I) is singular.
Hint
The inverse iteration converges to the eigenvector of the eigenvalue closest to mu.
Test cases
case 1
in: [[[2,0],[0,3]],1.9,[1,0]]
expected: [1,0]
case 2
in: [[[2,0],[0,3]],1.9,[1,1]]
expected: [0.9958932064677037,0.09053574604251859]
case 3
in: [[[3,1],[1,3]],1.5,[1,1]]
expected: [0.7071067811865475,0.7071067811865475]
case 4
in: [[[2,0],[0,3]],2,[1,0]]
expected: null
Starter codePython
def inverse_power_step(A, mu, v):
# Your code here
pass4 test cases · run your code against them in the editor