Concept

Basically Rayleigh quotient with inverse iteration

Features

  • high cost in every iteration since we are apply different shift.

Code

import numpy as np
 
def rayleigh_quotient_iteration(A, num_iter, tol=1e-6):
	x_k = np.random.rand(A.shape[1])
	for _ in range(num_iter):
		sigma = x_k.T @ A @ x_k / (x_k.T @ x_k)
		y_k = np.linalg.solve(A - sigma * np.eye(A.shape[0]), x_k)
		x_k_o = x_k
		x_k = y_k / np.linalg.norm(y_k)
		if np.linalg.norm(x_k - x_k_o) < tol:
			break
	return x_k